Commit ad8b809d by 前端

Merge branch 'v3.1.0' into 'master'

V3.1.0

See merge request !64
2 parents 16dc0402 b5c7d017
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-08 12:25:27
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-08 14:10:42
* @FilePath: \scrm-micro-drainage\public\hash.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// hash.js
self.importScripts('spark-md5.min.js')
self.onmessage = e => {
console.log(e)
const { file } = e.data
const spark = new self.SparkMD5.ArrayBuffer()
let count = 0
const loadNext = index => {
const reader = new FileReader()
reader.readAsArrayBuffer(file)
reader.onload = e => {
count++
spark.append(e.target.result)
var hexHash = spark.end()
var oParams = {}
oParams.fileMD5 = hexHash
oParams.file = e.target.result
oParams.size = file.size
self.postMessage(oParams)
}
}
loadNext(0)
}
(function(factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{var glob;try{glob=window}catch(e){glob=self}glob.SparkMD5=factory()}})(function(undefined){"use strict";var add32=function(a,b){return a+b&4294967295},hex_chr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<<s|a>>>32-s,b)}function md5cycle(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a+=(b&c|~b&d)+k[0]-680876936|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[1]-389564586|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[2]+606105819|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[3]-1044525330|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[4]-176418897|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[5]+1200080426|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[6]-1473231341|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[7]-45705983|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[8]+1770035416|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[9]-1958414417|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[10]-42063|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[11]-1990404162|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[12]+1804603682|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[13]-40341101|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[14]-1502002290|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[15]+1236535329|0;b=(b<<22|b>>>10)+c|0;a+=(b&d|c&~d)+k[1]-165796510|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[6]-1069501632|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[11]+643717713|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[0]-373897302|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[5]-701558691|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[10]+38016083|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[15]-660478335|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[4]-405537848|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[9]+568446438|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[14]-1019803690|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[3]-187363961|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[8]+1163531501|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[13]-1444681467|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[2]-51403784|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[7]+1735328473|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[12]-1926607734|0;b=(b<<20|b>>>12)+c|0;a+=(b^c^d)+k[5]-378558|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[8]-2022574463|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[11]+1839030562|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[14]-35309556|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[1]-1530992060|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[4]+1272893353|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[7]-155497632|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[10]-1094730640|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[13]+681279174|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[0]-358537222|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[3]-722521979|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[6]+76029189|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[9]-640364487|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[12]-421815835|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[15]+530742520|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[2]-995338651|0;b=(b<<23|b>>>9)+c|0;a+=(c^(b|~d))+k[0]-198630844|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[7]+1126891415|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[14]-1416354905|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[5]-57434055|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[12]+1700485571|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[3]-1894986606|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[10]-1051523|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[1]-2054922799|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[8]+1873313359|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[15]-30611744|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[6]-1560198380|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[13]+1309151649|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[4]-145523070|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[11]-1120210379|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[2]+718787259|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[9]-343485551|0;b=(b<<21|b>>>11)+c|0;x[0]=a+x[0]|0;x[1]=b+x[1]|0;x[2]=c+x[2]|0;x[3]=d+x[3]|0}function md5blk(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks}function md5blk_array(a){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=a[i]+(a[i+1]<<8)+(a[i+2]<<16)+(a[i+3]<<24)}return md5blks}function md51(s){var n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);length=s.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=s.charCodeAt(i)<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function md51_array(a){var n=a.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk_array(a.subarray(i-64,i)))}a=i-64<n?a.subarray(i-64):new Uint8Array(0);length=a.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=a[i]<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n){var s="",j;for(j=0;j<4;j+=1){s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15]}return s}function hex(x){var i;for(i=0;i<x.length;i+=1){x[i]=rhex(x[i])}return x.join("")}if(hex(md51("hello"))!=="5d41402abc4b2a76b9719d911017c592"){add32=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){(function(){function clamp(val,length){val=val|0||0;if(val<0){return Math.max(val+length,0)}return Math.min(val,length)}ArrayBuffer.prototype.slice=function(from,to){var length=this.byteLength,begin=clamp(from,length),end=length,num,target,targetArray,sourceArray;if(to!==undefined){end=clamp(to,length)}if(begin>end){return new ArrayBuffer(0)}num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})()}function toUtf8(str){if(/[\u0080-\uFFFF]/.test(str)){str=unescape(encodeURIComponent(str))}return str}function utf8Str2ArrayBuffer(str,returnUInt8Array){var length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff),i;for(i=0;i<length;i+=1){arr[i]=str.charCodeAt(i)}return returnUInt8Array?arr:buff}function arrayBuffer2Utf8Str(buff){return String.fromCharCode.apply(null,new Uint8Array(buff))}function concatenateArrayBuffers(first,second,returnUInt8Array){var result=new Uint8Array(first.byteLength+second.byteLength);result.set(new Uint8Array(first));result.set(new Uint8Array(second),first.byteLength);return returnUInt8Array?result:result.buffer}function hexToBinaryString(hex){var bytes=[],length=hex.length,x;for(x=0;x<length-1;x+=2){bytes.push(parseInt(hex.substr(x,2),16))}return String.fromCharCode.apply(String,bytes)}function SparkMD5(){this.reset()}SparkMD5.prototype.append=function(str){this.appendBinary(toUtf8(str));return this};SparkMD5.prototype.appendBinary=function(contents){this._buff+=contents;this._length+=contents.length;var length=this._buff.length,i;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk(this._buff.substring(i-64,i)))}this._buff=this._buff.substring(i-64);return this};SparkMD5.prototype.end=function(raw){var buff=this._buff,length=buff.length,i,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff.charCodeAt(i)<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var i=length,tmp,lo,hi;tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(this._hash,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=this._length*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf8(str),raw)};SparkMD5.hashBinary=function(content,raw){var hash=md51(content),ret=hex(hash);return raw?hexToBinaryString(ret):ret};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var buff=concatenateArrayBuffers(this._buff.buffer,arr,true),length=buff.length,i;this._length+=arr.byteLength;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk_array(buff.subarray(i-64,i)))}this._buff=i-64<length?new Uint8Array(buff.buffer.slice(i-64)):new Uint8Array(0);return this};SparkMD5.ArrayBuffer.prototype.end=function(raw){var buff=this._buff,length=buff.length,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i,ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff[i]<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=arrayBuffer2Utf8Str(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=utf8Str2ArrayBuffer(state.buff,true);return SparkMD5.prototype.setState.call(this,state)};SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy;SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish;SparkMD5.ArrayBuffer.hash=function(arr,raw){var hash=md51_array(new Uint8Array(arr)),ret=hex(hash);return raw?hexToBinaryString(ret):ret};return SparkMD5});
...@@ -74,7 +74,7 @@ var mixin = { ...@@ -74,7 +74,7 @@ var mixin = {
}, },
} }
const URL = const URL =
'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config' 'https://oss-config.dev.glsx.com.cn/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/task-config') => { const getConfig = (url = URL + '/task-config') => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request({ url }).then((res) => { request({ url }).then((res) => {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<div class="welcome-box"> <div class="welcome-box">
<div class="content"> <div class="content">
<div class="content-bg"> <div class="content-bg">
<!-- <input type="file" @change="uploadF" /> -->
<wTextarea <wTextarea
ref="textContent" ref="textContent"
v-model="textValue" v-model="textValue"
...@@ -274,8 +275,8 @@ ...@@ -274,8 +275,8 @@
type="file" type="file"
style="opacity: 0" style="opacity: 0"
:id="item.type + 'file'" :id="item.type + 'file'"
ref="file" ref="fileVideo"
class="welcome-input" class="welcome-input upload-video"
:accept="item.accept || 'video/*'" :accept="item.accept || 'video/*'"
@change="(e) => handleVideoChange(e)" @change="(e) => handleVideoChange(e)"
/> />
...@@ -331,6 +332,7 @@ const wordType = [ ...@@ -331,6 +332,7 @@ const wordType = [
'code', 'code',
] ]
import emoji from '../../utils/emo' import emoji from '../../utils/emo'
import upload from '../../utils/upload'
// import ActivityModel from './activityModel' // import ActivityModel from './activityModel'
// import MessageModel from './messageModel' // import MessageModel from './messageModel'
// import materialModel from './materialModel' // import materialModel from './materialModel'
...@@ -338,6 +340,8 @@ import Emotion from './emotionWords' ...@@ -338,6 +340,8 @@ import Emotion from './emotionWords'
import wTextarea from './tag-textarea' import wTextarea from './tag-textarea'
// import vuedraggable from 'vuedraggable' // import vuedraggable from 'vuedraggable'
import { utils } from 'glsx-common' import { utils } from 'glsx-common'
import { set } from 'vue'
import { commonApi } from '../../api/commonApi'
export default { export default {
name: 'GLEditor', name: 'GLEditor',
components: { components: {
...@@ -363,9 +367,14 @@ export default { ...@@ -363,9 +367,14 @@ export default {
type: Object, type: Object,
default: () => ATT_TYPE, default: () => ATT_TYPE,
}, },
linkStatus: {
type: Boolean,
default: true,
},
}, },
data() { data() {
return { return {
uploadInfo: null,
textNum: 0, textNum: 0,
maxNum: 1000, maxNum: 1000,
myArr: [{ name: 888 }, { name: 888 }], myArr: [{ name: 888 }, { name: 888 }],
...@@ -386,7 +395,6 @@ export default { ...@@ -386,7 +395,6 @@ export default {
}, },
mounted() { mounted() {
if (this.previewList.length) { if (this.previewList.length) {
// this.updateList(this.previewList, 1)
this.previewList.map((item) => { this.previewList.map((item) => {
if (item.materialType == ATT_TYPE.TEXT) { if (item.materialType == ATT_TYPE.TEXT) {
this.textValue = this.changeText(item.materialContent) this.textValue = this.changeText(item.materialContent)
...@@ -437,6 +445,16 @@ export default { ...@@ -437,6 +445,16 @@ export default {
}, },
}, },
methods: { methods: {
uploadF(e) {
this.uploadInfo.clickEvent(e.srcElement.files)
},
resetItem() {
this.previewList = []
this.textValue = ''
setTimeout(() => {
if (this.linkStatus) this.handleFun({ type: 'link' })
})
},
isPreview(preview, type) { isPreview(preview, type) {
return type return type
? preview.filter((item) => item.materialType == type).length ? preview.filter((item) => item.materialType == type).length
...@@ -502,29 +520,23 @@ export default { ...@@ -502,29 +520,23 @@ export default {
}, },
// 上传图片 // 上传图片
handleImgChange(e) { handleImgChange(e) {
// 判断是否有链接
var materialFlag = this.previewList.some((item) => {
if (item.materialType == ATT_TYPE.LINK) {
return true
}
})
if (materialFlag) {
document.querySelector('.upload-img').value = ''
this.$message.error(
'为规范小程序显示样式,专属链接不能与图片或视频同时配置'
)
return
}
this.$notify({ this.$notify({
title: '提示', title: '提示',
message: '图片上传中,请稍后', message: '图片上传中,请稍后',
}) })
// let imgFlag = false
// this.previewList.map((item) => {
// if (
// item.materialType != ATT_TYPE.IMAGE &&
// item.materialType != ATT_TYPE.TEXT
// ) {
// imgFlag = true
// }
// return imgFlag
// })
// let newList = []
// if (imgFlag) {
// this.previewList.map((item, index) => {
// if (item.materialType == this.ATT_TYPE.TEXT) {
// newList.push(item)
// }
// })
// this.previewList = newList
// }
var reader = new FileReader() var reader = new FileReader()
var file = e.srcElement.files[0] var file = e.srcElement.files[0]
// 默认1MB // 默认1MB
...@@ -592,65 +604,105 @@ export default { ...@@ -592,65 +604,105 @@ export default {
} }
} }
}, },
// 上传视频 getImgUrl(url, multiple = 3) {
async handleVideoChange(e) { return new Promise((resolve, reject) => {
// let videoFlag = false var canvas = document.createElement('canvas') // 获取 canvas 对象
// this.previewList.map((item) => { const ctx = canvas.getContext('2d') // 绘制2d
// if ( let video = document.getElementById('video')
// item.materialType != ATT_TYPE.VEDIO && video.src = url
// item.materialType != ATT_TYPE.TEXT video.crossOrigin = 'anonymous' // 解决跨域问题,也就是提示污染资源无法转换视频
// ) { video.currentTime = 1 // 第一帧
// videoFlag = true video.oncanplay = async () => {
// } canvas.width = video.clientWidth * multiple // 获取视频宽度
// return videoFlag canvas.height = video.clientHeight * multiple // 获取视频高度
// }) // 利用canvas对象方法绘图
// let newList = [] ctx.drawImage(
// if (videoFlag) { video,
// this.previewList.map((item, index) => { 0,
// if (item.materialType == this.ATT_TYPE.TEXT) { 0,
// newList.push(item) video.clientWidth * multiple,
// } video.clientHeight * multiple
// })
// this.previewList = newList
// }
var file
try {
file = await this.uploadFileVideo(e)
this.$notify({
title: '提示',
message: '视频上传中,请稍后',
})
if (this.videoList.togetherItem) {
this.previewList = this.previewFilter(
this.videoList.togetherItem,
ATT_TYPE.VEDIO
) )
console.log(canvas, 'canvas')
// 转换成base64形式
var oGrayImg = canvas.toDataURL('image/png') // 截取后的视频封面
const file = this.dataURLtoFile(oGrayImg)
const imgUrl = await this.uploadImg(file)
resolve(imgUrl)
} }
})
},
//将base64转换为文件
dataURLtoFile(dataurl, filename = '1.png') {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], filename, { type: mime })
},
uploadImg(fileInfo) {
return new Promise((resolve, reject) => {
var reader = new FileReader() var reader = new FileReader()
reader.readAsDataURL(file) reader.readAsDataURL(fileInfo)
reader.onload = (e) => { reader.onload = (e) => {
const imgFile = e.target.result const imgFile = e.target.result
const arrBase64 = imgFile.split(',') const base64 =
const splitStr = file.name.split('.') fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1] commonApi.uploadImgApi({ file: base64 }).then((res) => {
// const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1] resolve(res)
this.videoList.uploadApi({ file: fileUrl }).then((res) => { })
console.log(res) }
if (res) { })
this.$notify({ },
// 上传视频
async handleVideoChange(e) {
// 判断是否有链接
var materialFlag = this.previewList.some((item) => {
if (item.materialType == ATT_TYPE.LINK) {
return true
}
})
if (materialFlag) {
document.querySelector('.upload-video').value = ''
this.$message.error(
'为规范小程序显示样式,专属链接不能与图片或视频同时配置'
)
return
}
await this.uploadFileVideo(e)
const that = this
this.uploadInfo = new upload({
showprocess: true,
success: function (res) {
document.querySelector('.upload-video').value = ''
that.$notify({
title: '提示', title: '提示',
message: '视频上传成功', message: '视频上传成功',
type: 'success', type: 'success',
}) })
this.previewList.push({ that.previewList.push({
materialType: this.ATT_TYPE.VEDIO, materialType: that.ATT_TYPE.VEDIO,
materialContent: res.data.data, materialContent: res,
}) })
} that.$nextTick(() => {
const videoUrl = res
that.getImgUrl(videoUrl).then((res) => {
console.log(res, 'videoimg')
that.$emit('getVideoImg', res.data.data)
that.$emit('getEditor')
}) })
} })
} catch (err) {} },
})
this.$notify({
title: '提示',
message: '视频上传中,请稍后',
})
this.uploadInfo.clickEvent(e.srcElement.files)
}, },
// 上传链接弹框 // 上传链接弹框
handleLinkChange() { handleLinkChange() {
...@@ -688,7 +740,7 @@ export default { ...@@ -688,7 +740,7 @@ export default {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let file = e.srcElement.files[0] let file = e.srcElement.files[0]
// 默认10MB // 默认10MB
const limitSize = this.videoList.limitSize || 10 const limitSize = this.videoList.limitSize || 50
const isLt = file.size / 1024 / 1024 < limitSize const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) { if (!isLt) {
_this.$message.error('上传视频大小不能超过' + limitSize + 'MB!') _this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
...@@ -728,6 +780,21 @@ export default { ...@@ -728,6 +780,21 @@ export default {
}) })
}, },
handleFun(type) { handleFun(type) {
// 判断是否有图片或者视频
var materialFlag = this.previewList.some((item) => {
if (
item.materialType == ATT_TYPE.IMAGE ||
item.materialType == ATT_TYPE.VEDIO
) {
return true
}
})
if (materialFlag) {
this.$message.error(
'为规范小程序显示样式,专属链接不能与图片或视频同时配置'
)
return
}
const name = type.type const name = type.type
if (name == 'nickname') { if (name == 'nickname') {
this.$refs.textContent.addTag('@昵称') this.$refs.textContent.addTag('@昵称')
...@@ -743,13 +810,10 @@ export default { ...@@ -743,13 +810,10 @@ export default {
if (this.previewList.length) { if (this.previewList.length) {
let linkFlag = 0 let linkFlag = 0
this.previewList.map((item) => { this.previewList.map((item) => {
console.log(item)
if (item.materialType == this.ATT_TYPE.LINK) { if (item.materialType == this.ATT_TYPE.LINK) {
console.log(111)
linkFlag = linkFlag + 1 linkFlag = linkFlag + 1
} }
}) })
console.log(linkFlag, 'linkFlag')
if (linkFlag > 0) { if (linkFlag > 0) {
this.$message.warning('最多上传一条活动专属链接!') this.$message.warning('最多上传一条活动专属链接!')
return return
...@@ -760,7 +824,6 @@ export default { ...@@ -760,7 +824,6 @@ export default {
materialType: this.ATT_TYPE.LINK, materialType: this.ATT_TYPE.LINK,
materialContent: '#活动专属链接#', materialContent: '#活动专属链接#',
}) })
console.log(this.previewList)
} }
}, },
close(index) { close(index) {
......
...@@ -12,10 +12,10 @@ export const nearlyAMonth = { ...@@ -12,10 +12,10 @@ export const nearlyAMonth = {
let month = date.getMonth() + 1 let month = date.getMonth() + 1
let day = date.getDate() let day = date.getDate()
let aheadOfMonth = month == '1' ? '12' : month - 1 let aheadOfMonth = month == '1' ? '12' : month - 1
let preDays = this.mGetDate(year, aheadOfMonth)
if (aheadOfMonth == '12') { if (aheadOfMonth == '12') {
preYear = preYear - 1 preYear = preYear - 1
} }
let preDays = this.mGetDate(preYear, aheadOfMonth)
this.defalutEndTime = year + '-' + month + '-' + day this.defalutEndTime = year + '-' + month + '-' + day
if (day > preDays) { if (day > preDays) {
this.defalutStartTime = preYear + '-' + aheadOfMonth + '-' + preDays this.defalutStartTime = preYear + '-' + aheadOfMonth + '-' + preDays
......
/**
* 封装文件上传插件
* showprocess:是否展示进度条 | Boolean | 默认true
* action:上传接口 | tring类型 | 非必填
* tips: 上传文件说明 | String类型 或者 Number类型 | 非必填
* size: 大文件分割切片大小 | Number类型 | 默认为2M
* success: 文件上传成功回调 | Function | 非必填
* error:文件上传失败回调 | Function | 非必填
* accept:支持上传文件格式 | Array类型 | 非必填
* max: 限制上传文件大小 | Number类型 | 非必填 | 单位为M
* data: 额外上传的参数 | Object类型 | 非必填
* beforeUpload: 上传之前校验 | Function | 非必填
*/
import MD5 from 'md5'
var that = ''
var w = {}
var upload = function (options) {
//upload("options") 或者 new upload("options")都可以使用upload方法
if (!(this instanceof upload)) {
return new upload(options)
}
// 参数合并 extend方法体在下面
this.options = this.extend(
{
showprocess: true,
action: '',
tips: '',
size: 2,
url: '',
success: '',
},
options
)
// 基本公用的配置
this.config = {
id: '',
token: '',
app_key: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
url: 'http://didicb.glsx.com.cn/router',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
}
/*this.token = '';
this.app_key = '48e5e13229b82c1b4e6e8c96151f0637';
this.v = '1.0.0';
this.format = 'json';
this.url = 'http://qcdidicb.glsx.net:7060/router';
this.secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b';*/
//初始化
//this.init();
that = this
}
upload.prototype = {
/**
* 初始化方法
*/
init: function (id) {
if (!id) {
return false
}
var o = that.options
that.config.id = id
//创建最外层div
var _div = document.createElement('div')
_div.className = 'test'
_div.style = 'position:relative;'
//创建按钮div
var _iptdiv = document.createElement('div')
_iptdiv.className = 'upload_button_box'
_iptdiv.style = 'position:relative;'
//创建选择文件input
var _input = document.createElement('input')
_input.type = 'file'
_input.className = 'file_input'
_input.style =
'opacity:0;position:absolute;top:0px;right:0px;bottom:0px;left:0px;font-size:14px;'
_input.onchange = this.clickEvent
_iptdiv.appendChild(_input)
//创建按钮
var _button = document.createElement('button')
_button.className = 'testbu'
_button.innerText = '选择文件'
_button.style =
'border:1px solid #409eff;background:#409eff;color:#fff;border-radius:4px;padding:6px 14px;outline:none;font-size:14px;'
_iptdiv.appendChild(_button)
_div.appendChild(_iptdiv)
//创建文件展示区域
var _fileDiv = document.createElement('div')
_fileDiv.className = 'upload_file_show_box'
_fileDiv.id = 'upload_file_show_box'
_fileDiv.style = 'position:absolute;left:0px;font-size:12px;color:#999;'
//创建提示语
if (o.tips) {
var _tipsDiv = document.createElement('div')
_tipsDiv.innerText = o.tips
_tipsDiv.style = 'font-size:12px;color:#999;line-height:2;'
_fileDiv.appendChild(_tipsDiv)
}
//创建file文件名展示
var _fileNameDiv = document.createElement('div')
_fileNameDiv.id = 'upload_file_name_box'
_fileNameDiv.style = 'color:#333;line-height:2;'
_fileDiv.appendChild(_fileNameDiv)
_div.appendChild(_fileDiv)
if (o.showprocess) {
//创建进度条
var _pDiv = document.createElement('div')
_pDiv.className = 'progress_box'
_pDiv.id = 'upload_progress_box'
_pDiv.style =
'background:#ebeef5;border-radius:100px;position:relative;height:2px;min-width:200px;display:none;'
//创建进度条内部
var _iDiv = document.createElement('div')
_iDiv.className = 'progress_box_inner'
_iDiv.style =
'background:#409eff;border-radius:2px;position:absolute;left:0px;top:0px;bottom:0px;border-radius:100px;'
_pDiv.appendChild(_iDiv)
_fileDiv.appendChild(_pDiv)
}
var _obj = document.querySelector('#' + id)
_obj.appendChild(_div)
},
// 参数合并方法体
extend: function (obj, obj2) {
for (var key in obj2) {
obj[key] = obj2[key]
// 确保参数唯一
}
return obj
},
/**
* 监听文件变化
*/
// clickEvent: function(e) {
// var files = document.querySelector('#' + that.config.id + ' input.file_input').files
// console.log(files[0])
// if (!files || files.length <= 0) {
// return false
// }
// that.checkFile(files[0])
// },
clickEvent: function (e) {
var files = e
if (!files || files.length <= 0) {
return false
}
that.checkFile(files[0])
},
/**
* 处理选中的文件
*/
treatEvent: async function (file) {
//var random = Math.random();
// var _workerJs = await that.calculateHashWorker()
// var _workerJs = that.createWorker()
var webWorker = new Worker('/hash.js')
// if (that.options.showprocess) {
// document.querySelector('#' + that.config.id + ' div#upload_file_name_box').innerText = file.name
// document.querySelector('#' + that.config.id + ' div#upload_progress_box') ? (document.querySelector('#' + that.config.id + ' div#upload_progress_box').style.display = 'block') : ''
// }
var oParams = {}
oParams.file = file
oParams.config = that.config
//oParams.options = that.options;
webWorker.postMessage(oParams)
webWorker.onmessage = function (e) {
console.log(e)
var _obj = e.data
w = _obj
// var arr = that.fileSlice(_obj);
// var files = arr;
// //获取token
var r1 = getToken(file)
// var r1 = that.getToken(file, arr.length);
// //获取检查文件上传情况
// var r2 = that.checkFileIsUpload(_obj.md5);
var _arr = fileSlice(_obj)
w.list = _arr
w.fileMD5 = _obj.fileMD5
Promise.all([r1]).then((res) => {
var _token = res[0]
that.config.token = _token
checkFileIsUpload(_obj.fileMD5).then((res) => {
var _data = res.data
if (res.code == 0) {
//如果存在fileUrl,则证明服务器存在该文件
if (_data.fileUrl) {
_allCallback(_data.fileUrl)
return false
}
send(_arr)
}
})
})
}
},
/**
* 文件校验
*/
checkFile: function (file) {
var o = that.options
var max = o.max ? Number(o.max) * 1024 * 1024 : ''
if (max && file.size > max) {
alert('文件过大')
return false
}
//文件上传前回调
if (o.beforeUpload) {
var n = o.beforeUpload()
if (n === false) {
return false
}
}
//
that.treatEvent(file)
},
async calculateHashWorker() {
return new Promise((resolve) => {
this.worker = new Worker('/hash.js')
this.worker.postMessage({ chunks: this.chunks })
this.worker.onmessage = (e) => {
const { hash } = e.data
if (hash) {
resolve(hash)
}
}
})
},
// //创建worker分线程
// createWorker: function() {
// var myWorker = function() {
// let that = this
// let w = {}
// // importScripts('https://img01.glsx.com.cn/weapp/resource/file-upload/spark-md5.min.js')
// that.addEventListener(
// 'message',
// function(e) {
// var _obj = e.data
// var files = _obj.file
// var spark = new SparkMD5.ArrayBuffer()
// var reader = new FileReader()
// w.config = _obj.config
// w.options = _obj.options
// w.file = _obj.file
// //var r1 = getToken(files);
// reader.readAsArrayBuffer(files)
// reader.onload = function(e) {
// console.log('加密开始:' + new Date().getTime())
// spark.append(e.target.result)
// var hexHash = spark.end()
// if (hexHash) {
// console.log('加密结束:' + new Date().getTime())
// }
// var oParams = {}
// oParams.fileMD5 = hexHash
// oParams.file = e.target.result
// oParams.size = files.size
// //w.fileMD5 = hexHash;
// that.postMessage(oParams)
// /*var _arr = fileSlice(oParams);
// console.log(_arr)
// w.list = _arr;
// Promise.all([r1]).then(res => {
// checkFileIsUpload(hexHash).then(res => {
// console.log(res);
// if (res.code == 0) {
// send(_arr);
// }
// });
// })*/
// }
// },
// false
// )
// }
// var workerData = new Blob(['(' + myWorker.toString() + ')()'], {
// type: 'text/javascript'
// })
// return workerData
// }
}
/**
* 封装请求方法
*/
function request(options) {
return new Promise(function (resolve, reject) {
var _url = options.url
var _data = options.data
var xhr = new XMLHttpRequest()
// 设置超时时间,0表示永不超时
xhr.timeout = options.timeout || 0
//设置返回数据类型
xhr.responseType = options.responseType || 'json'
//请求成功
xhr.onload = function (res) {
resolve(res.target.response)
}
//请求失败
xhr.onerror = function (res) {
reject(res.target.response)
}
//请求超时
xhr.ontimeout = function (res) {
reject(res.target.response)
}
if (options.method == 'GET' || options.method == 'get') {
//formRequestData(options.data);
var _str = formRequestData(_data)
_url = _url + '?' + _str
_data = ''
}
xhr.open(options.method || 'post', _url, true)
//xhr.setRequestHeader("Content-type", options.header || "application/json");
if (options.method == 'POST' || options.method == 'post') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
//xhr.setRequestHeader("Content-type", options.header || "application/json");
//xhr.send(JSON.stringify(_data));
var _str_d = formRequestData(_data)
xhr.send(_str_d)
} else {
xhr.send()
}
})
}
/**
* 文件上传
*/
function send(arr) {
let max = 3 //最多允许同时执行的ajax次数
var current = 0 //当前有多少ajax正在执行
var _name = getFileType(w.fileName)
let _num = 0
var len = arr.length
var hasFile = false
/* var _index = 0;
while (arr[_index]) {
current++;
var c = arr.shift();
var fileBase64 = transformArrayBufferToBase64(c);
var oParams = getParams(_index, fileBase64);
var o = {};
oParams.file = oParams.fileType + '@' + fileBase64;
o.method = 'POST';
o.data = oParams;
o.url = that.config.url + '?method=glsx.accounts.biz.common.uploadFileWithFileInfo';
_index++;
//如果存在url,则直接跳出循环
if (hasFile) {
return false;
}
request(o).then(res => {
if (res.code == 0) {
this._num++;
current--;
var _obj = res.data;
document.querySelector("div#upload_progress_box .progress_box_inner").style.width = this._num / len * 100 + '%';
if (this._num == len) {
document.querySelector("div#upload_progress_box").style.display = "none";
}
//如果存在url,则直接跳出循环
if (res.data.fileUrl) {
document.querySelector("div#upload_progress_box").style.display = "none";
hasFile = true;
_allCallback(res.data.fileUrl);
return false;
}
}
}).catch(res => {
current--;
});
}
return false; */
for (let i = len - 1; i >= 0; i--) {
var _index = i
var fileBase64 = transformArrayBufferToBase64(arr[i])
var oParams = getParams(_index, fileBase64)
var o = {}
oParams.file = oParams.fileType + '@' + fileBase64
o.method = 'POST'
o.data = oParams
o.url =
(that.options.url || that.config.url) +
'?method=glsx.accounts.biz.common.uploadFileWithFileInfo'
//fileFragmentUpload(o);
//如果存在url,则直接跳出循环
if (hasFile) {
return false
}
request(o).then((res) => {
if (res.code == 0) {
_num++
var _obj = res.data
// 如果有进度条,则设置对应的进度条属性
// if (that.options.showprocess) {
// document.querySelector('#' + that.config.id + ' div#upload_progress_box .progress_box_inner').style.width = (_num / len) * 100 + '%'
// if (_num == len) {
// document.querySelector('#' + that.config.id + ' div#upload_progress_box').style.display = 'none'
// }
// }
//如果存在url,则直接跳出循环
if (res.data.fileUrl) {
if (that.options.showprocess) {
// document.querySelector('#' + that.config.id + ' div#upload_progress_box').style.display = 'none'
}
hasFile = true
_allCallback(res.data.fileUrl)
return false
}
}
})
}
}
/**
* 所有分片上传成功回调函数
*/
function _allCallback(url) {
//console.log(url);
if (url) {
that.options.success ? that.options.success(url) : ''
}
}
/**
* 分片上传
*/
function fileFragmentUpload(oParams) {
request()
.then((res) => {
if (res.code == 0) {
this._num++
var _obj = res.data
// 如果有进度条,则设置对应的进度条属性
// if (that.options.showprocess) {
// document.querySelector('#' + that.config.id + ' div#upload_progress_box .progress_box_inner').style.width = (this._num / this.len) * 100 + '%'
// if (this._num == this.len) {
// document.querySelector('#' + that.config.id + ' div#upload_progress_box').style.display = 'none'
// }
// }
_allCallback(res.data.fileUrl)
/* if(_obj.fileUrl){
that.options.success? (that.options.success)(_obj.fileUrl):''
}; */
}
})
.catch((res) => {
fileFragmentUpload(oParams)
})
}
/**
* 生成签名
*/
function createSign(params) {
var secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
var noSignAttr = []
delete params.sign
noSignAttr.push('refreshTable')
var keys = Object.keys(params).sort()
var str = []
var obj = null
for (const key in params) {
obj = params[key]
if (obj === null || obj === undefined) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
params[key] = obj
}
keys.forEach((e) => {
!noSignAttr.includes(e) && str.push(e + params[e])
})
params.sign = MD5(secret + str.join('') + secret)
return params
}
/**
* 获取参数
*/
function getParams(index, oInfo) {
var o = that.options
var k = that.config
var oParams = {}
var len = w.list.length
var size = Number(o.size * 1024 * 1024)
// console.log(o.size)
// console.log(w);
// console.log('个数:' + w.list.length);
// console.log('当前个数' + index)
if (len > 1 && index == len - 1) {
size = w.fileSize - o.size * 1024 * 1024 * (w.list.length - 2)
}
//只有一个分片
if (w.list.length == 1) {
size = w.fileSize
}
// var spark = new MD5()
// spark.append(oInfo)
oParams.app_key = k.app_key
oParams.v = k.v
oParams.timestamp = new Date().getTime()
oParams.format = k.format
oParams.source = '2323242323'
oParams.method = 'glsx.accounts.biz.common.uploadFileWithFileInfo'
oParams.token = w.token
oParams.number = index + 1
oParams.fileType = w.fileType
oParams.fileName = w.fileName
oParams.fileSize = w.fileSize
oParams.fileFragmentSize = size
oParams.fileUpSum = w.list.length
oParams.fileMD5 = w.fileMD5
oParams.fragmentMD5 = MD5(oInfo)
// for (let k in m) {
// oParams.append(k, m[k]);
// }
return createSign(oParams)
}
/**
* 获取token
*/
function getToken(file) {
return new Promise(function (resolve, reject) {
var _obj = that.config
var o = {}
var oParams = {}
oParams.fileSize = file.size
oParams.fileUpSum = Math.ceil(file.size / (that.options.size * 1024 * 1024))
oParams.fileType = getFileType(file.name)
oParams.fileName = file.name
oParams.method = 'glsx.accounts.biz.common.getUploadFileToken'
oParams.app_key = _obj.app_key
oParams.v = _obj.v
oParams.format = _obj.format
//这三个参数动态,由用户自己上传
oParams.lastOperatorId = '11111'
oParams.lastOperatorName = 'jack'
oParams.source = '2323242323'
oParams.timestamp = new Date().getTime()
//把文件信息存起来
w.fileSize = oParams.fileSize //文件大小
w.fileUpSum = oParams.fileUpSum //分片个数
w.fileType = oParams.fileType //文件类型
w.fileName = oParams.fileName //文件名称
o.url = that.options.url || that.config.url || _obj.url
o.data = createSign(oParams)
o.method = 'GET'
request(o)
.then((res) => {
if (res.code == 0) {
var _data = res.data || {}
w.token = _data.token
resolve(_data.token)
}
})
.catch((res) => {
reject(res)
})
})
}
/**
* 参数序列化
*/
function formRequestData(data) {
var _sendstr = null
if (data) {
_sendstr = ''
for (var i in data) {
_sendstr += (_sendstr ? '&' : '') + i + '=' + encodeURIComponent(data[i])
}
}
return _sendstr
}
/**
* 检查文件是否上传
*/
function checkFileIsUpload(md5) {
return new Promise((resolve, reject) => {
if (!md5) {
return false
}
var _obj = that.config
var o = {}
var oParams = {}
oParams.fileMD5 = md5
oParams.token = _obj.token
oParams.app_key = _obj.app_key
oParams.v = _obj.v
oParams.format = _obj.format
oParams.timestamp = new Date().getTime()
oParams.method = 'glsx.accounts.biz.common.checkAndListFragmentDetail'
o.url = that.options.url || that.config.url || _obj.url
o.data = createSign(oParams)
o.method = 'GET'
request(o)
.then((res) => {
if (res.code == 0) {
resolve(res)
}
})
.catch((res) => {
reject(res)
})
})
}
/**
* 文件切片
*/
function fileSlice(oParams) {
if (!oParams) {
return false
}
var o = that.options
var file = oParams.file
var cellBlod = []
var cell = Number(o.size) * 1024 * 1024 //单个分片的大小
var size = oParams.size //文件大小
var num = Math.ceil(size / cell) //计算分片的个数
if (num == 1) {
cellBlod.push(file)
} else {
for (var i = 0; i < num; i++) {
var s = i * cell
var e = (i + 1) * cell
var m = ''
if (file.slice) {
m = file.slice(s, e)
}
//兼容firefox
if (file.mozSlice) {
m = file.mozSlice(s, e)
}
// 兼容webkit
if (file.webkitSlice) {
m = file.webkitSlice(s, e)
}
cellBlod.push(m)
}
}
return cellBlod
}
/**
* 获取文件类型
*/
function getFileType(file) {
if (!file) {
return false
}
var arr = file.split('.')
return arr[arr.length - 1]
}
/**
* arrbuffer转换成base64
*/
function transformArrayBufferToBase64(buffer) {
var binary = ''
var bytes = new Uint8Array(buffer)
for (var len = bytes.byteLength, i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i])
}
return window.btoa(binary)
}
//暴露对象
export default upload
<template> <template>
<el-form <el-form
size='small' size="small"
inline inline
ref='withdrawalForm' ref="withdrawalForm"
:model='profitSearchForm' :model="profitSearchForm"
label-width='120px' label-width="120px"
class='demo-form-inline' class="demo-form-inline"
> >
<el-form-item label='员工名称'> <el-form-item label="员工名称">
<el-input <el-input
clearable clearable
v-model='profitSearchForm.staffName' v-model="profitSearchForm.staffName"
placeholder='请输入员工名称' placeholder="请输入员工名称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label='员工手机号'> <el-form-item label="员工手机号">
<el-input <el-input
clearable clearable
v-model='profitSearchForm.staffPhone' v-model="profitSearchForm.staffPhone"
placeholder='请输入员工手机号' placeholder="请输入员工手机号"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label='所属业务场景'> <el-form-item label="所属业务场景">
<el-select v-model='profitSearchForm.businessScene' placeholder='所属业务场景'> <el-select
<el-option label='全部' value=''></el-option> v-model="profitSearchForm.businessScene"
<el-option label='1.0 新车权益销售' value='0'></el-option> placeholder="所属业务场景"
<el-option label='1.1 次新车精品升级' value='1'></el-option> >
<el-option label='1.2 次新车线上转化' value='2'></el-option> <el-option label="全部" value=""></el-option>
<el-option label='1.3 存量用户众筹' value='3'></el-option> <el-option label="1.0 新车权益升级" value="0"></el-option>
<el-option label="1.1 新车精品升级" value="1"></el-option>
<el-option label="1.2 新车膨胀金活动" value="2"></el-option>
<el-option label="1.3 售后直播众筹活动" value="3"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label='所属商户:'> <el-form-item label="所属商户:">
<el-input <el-input
clearable clearable
v-model='profitSearchForm.merchantName' v-model="profitSearchForm.merchantName"
placeholder='请输入所属商户' placeholder="请输入所属商户"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label='所属活动/产品:'> <el-form-item label="所属活动/产品:">
<el-input <el-input
clearable clearable
v-model='profitSearchForm.activityName' v-model="profitSearchForm.activityName"
placeholder='请输入所属活动/产品' placeholder="请输入所属活动/产品"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label='发放渠道:'> <el-form-item label="发放渠道:">
<el-select v-model='profitSearchForm.channel' placeholder='请选择发放渠道'> <el-select
<el-option label='全部' value=''></el-option> v-model="profitSearchForm.channel"
<el-option label='广联' value='1'></el-option> placeholder="请选择发放渠道"
<el-option label='门店' value='2'></el-option> >
<el-option label='服务商' value='3'></el-option> <el-option label="全部" value=""></el-option>
<el-option label="广联" value="1"></el-option>
<el-option label="门店" value="2"></el-option>
<el-option label="服务商" value="3"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label='关联任务:'> <el-form-item label="关联任务:">
<el-input <el-input
clearable clearable
v-model='profitSearchForm.missionName' v-model="profitSearchForm.missionName"
placeholder='请输入关联任务' placeholder="请输入关联任务"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label='奖励时间'> <el-form-item label="奖励时间">
<el-date-picker <el-date-picker
value-format='yyyy-MM-dd' value-format="yyyy-MM-dd"
v-model='profitSearchForm.rewardTime' v-model="profitSearchForm.rewardTime"
type='daterange' type="daterange"
range-separator='至' range-separator="至"
start-placeholder='开始日期' start-placeholder="开始日期"
end-placeholder='结束日期'> end-placeholder="结束日期"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type='primary' @click='handleSearch' <el-button type="primary" @click="handleSearch">查询 </el-button>
>查询 <el-button @click="reset">重置</el-button>
</el-button
>
<el-button @click='reset'>重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
...@@ -83,12 +87,12 @@ ...@@ -83,12 +87,12 @@
import { nearlyAMonth } from '@/mixin/nearlyAMonth' import { nearlyAMonth } from '@/mixin/nearlyAMonth'
export default { export default {
name: 'ProfitSearch', name: 'ProfitSearch',
mixins:[nearlyAMonth], mixins: [nearlyAMonth],
data() { data() {
return { return {
profitSearchForm: { profitSearchForm: {
businessScene:'', businessScene: '',
channel:'' channel: '',
}, },
} }
}, },
...@@ -100,21 +104,25 @@ export default { ...@@ -100,21 +104,25 @@ export default {
Object.keys(this.profitSearchForm).forEach((key) => { Object.keys(this.profitSearchForm).forEach((key) => {
this.profitSearchForm[key] = '' this.profitSearchForm[key] = ''
}) })
this.$set(this.profitSearchForm, 'rewardTime', [this.defalutStartTime, this.defalutEndTime]) this.$set(this.profitSearchForm, 'rewardTime', [
this.defalutStartTime,
this.defalutEndTime,
])
this.$nextTick(() => { this.$nextTick(() => {
this.handleSearch() this.handleSearch()
}) })
} },
}, },
created() { created() {
this.$set(this.profitSearchForm, 'rewardTime', [this.defalutStartTime, this.defalutEndTime]) this.$set(this.profitSearchForm, 'rewardTime', [
this.defalutStartTime,
this.defalutEndTime,
])
}, },
mounted() { mounted() {
this.handleSearch() this.handleSearch()
} },
} }
</script> </script>
<style scoped> <style scoped></style>
</style>
<template> <template>
<div style='margin: 16px'> <div style="margin: 16px">
<ProfitSearch @sendSearchForm='getSearchForm' /> <ProfitSearch @sendSearchForm="getSearchForm" />
<el-button type='primary' size='small' @click='handleOutput'>导出</el-button> <el-button type="primary" size="small" @click="handleOutput"
<div class='cumulativeAward'>累计发放奖励:{{ totalScore }}</div> >导出</el-button
>
<div class="cumulativeAward">累计发放奖励:{{ totalScore }}</div>
<d2-table <d2-table
class='my-row-height' class="my-row-height"
ref='profitTable' ref="profitTable"
:hasNum='true' :hasNum="true"
@sendAlldata ='getTotalScore' @sendAlldata="getTotalScore"
:tableParams='profitTableParams' :tableParams="profitTableParams"
:searchForm='profitSearchForm' :searchForm="profitSearchForm"
:getListApi='getListApi' :getListApi="getListApi"
:pageConf='pageConf' :pageConf="pageConf"
> >
<div slot="businessScene" slot-scope="scope"> <div slot="businessScene" slot-scope="scope">
<span v-if="scope.scope.businessScene == '0'">1.0 新车权益销售</span> <span v-if="scope.scope.businessScene == '0'">1.0 新车权益升级</span>
<span v-if="scope.scope.businessScene == '1'">1.1 次新车精品升级</span> <span v-if="scope.scope.businessScene == '1'">1.1 新车精品升级</span>
<span v-if="scope.scope.businessScene == '2'">1.2 次新车线上转化</span> <span v-if="scope.scope.businessScene == '2'">1.2 新车膨胀金活动</span>
<span v-if="scope.scope.businessScene == '3'">1.3 存量用户众筹</span> <span v-if="scope.scope.businessScene == '3'"
>1.3 售后直播众筹活动</span
>
</div> </div>
<div slot="channel" slot-scope="scope"> <div slot="channel" slot-scope="scope">
<span v-if="scope.scope.channel == '1'">广联</span> <span v-if="scope.scope.channel == '1'">广联</span>
<span v-if="scope.scope.channel == '2'">门店</span> <span v-if="scope.scope.channel == '2'">门店</span>
<span v-if="scope.scope.channel == '3'">服务商</span> <span v-if="scope.scope.channel == '3'">服务商</span>
</div> </div>
</d2-table> </d2-table>
</div> </div>
</template> </template>
...@@ -37,16 +40,16 @@ import { profitApi } from '@/api/profitManagement' ...@@ -37,16 +40,16 @@ import { profitApi } from '@/api/profitManagement'
export default { export default {
name: 'WithdrawalSearch', name: 'WithdrawalSearch',
components: { components: {
ProfitSearch ProfitSearch,
}, },
data() { data() {
return { return {
profitSearchForm:{}, profitSearchForm: {},
totalScore: '', totalScore: '',
pageConf: { pageConf: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageNum: 'pageNum', pageNum: 'pageNum',
totalCount: 'data.count' totalCount: 'data.count',
}, },
getListApi: profitApi.searchProfitList, getListApi: profitApi.searchProfitList,
profitTableParams: { profitTableParams: {
...@@ -54,44 +57,44 @@ export default { ...@@ -54,44 +57,44 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: '员工名称', label: '员工名称',
prop: 'staffName' prop: 'staffName',
}, },
{ {
label: '员工手机号', label: '员工手机号',
prop: 'staffPhone' prop: 'staffPhone',
}, },
{ {
label: '奖励积分值', label: '奖励积分值',
prop: 'rewardScore' prop: 'rewardScore',
}, },
{ {
label: '关联任务', label: '关联任务',
prop: 'missionName' prop: 'missionName',
}, },
{ {
label: '发放渠道', label: '发放渠道',
prop: 'channel', prop: 'channel',
addHtml: 'channel' addHtml: 'channel',
}, },
{ {
label: '所属活动/产品', label: '所属活动/产品',
prop: 'activityName' prop: 'activityName',
}, },
{ {
label: '所属商户', label: '所属商户',
prop: 'merchantName' prop: 'merchantName',
}, },
{ {
label: '所属业务场景', label: '所属业务场景',
prop: 'businessScene', prop: 'businessScene',
addHtml:'businessScene' addHtml: 'businessScene',
}, },
{ {
label: '奖励时间', label: '奖励时间',
prop: 'rewardTime' prop: 'rewardTime',
} },
] ],
} },
} }
}, },
methods: { methods: {
...@@ -99,41 +102,43 @@ export default { ...@@ -99,41 +102,43 @@ export default {
handleOutput() { handleOutput() {
let params = JSON.parse(JSON.stringify(this.profitSearchForm)) let params = JSON.parse(JSON.stringify(this.profitSearchForm))
let pageConfig = { let pageConfig = {
pageSize:9999,pageNum:1 pageSize: 9999,
pageNum: 1,
} }
profitApi.exportProfitList({...params,...pageConfig}).then(res => { profitApi.exportProfitList({ ...params, ...pageConfig }).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.$Utils.exportFn(res.data) this.$Utils.exportFn(res.data)
} else { } else {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '导出失败!' message: '导出失败!',
}) })
} }
}) })
}, },
getSearchForm(val){ getSearchForm(val) {
let params = JSON.parse(JSON.stringify(val)) let params = JSON.parse(JSON.stringify(val))
if (params && params.rewardTime) { if (params && params.rewardTime) {
params.rewardBeginTime = params.rewardTime[0] params.rewardBeginTime = params.rewardTime[0]
params.rewardEndTime = params.rewardTime[1] params.rewardEndTime = params.rewardTime[1]
} }
if(params.rewardTime && params.rewardTime.length) delete params.rewardTime if (params.rewardTime && params.rewardTime.length)
delete params.rewardTime
this.profitSearchForm = params this.profitSearchForm = params
setTimeout(() =>{ setTimeout(() => {
this.$refs.profitTable.refreshTable(false,true) this.$refs.profitTable.refreshTable(false, true)
},500) }, 500)
}, },
getTotalScore(val){ getTotalScore(val) {
let {totalScore} = val let { totalScore } = val
this.totalScore = totalScore this.totalScore = totalScore
} },
}, },
} }
</script> </script>
<style scoped> <style scoped>
.cumulativeAward{ .cumulativeAward {
margin: 16px 0; margin: 16px 0;
} }
.my-row-height >>> .el-table__body-wrapper .el-table__row { .my-row-height >>> .el-table__body-wrapper .el-table__row {
......
...@@ -101,15 +101,12 @@ export default { ...@@ -101,15 +101,12 @@ export default {
item.startTime = dayjs(item.startTime).format('YYYY-MM-DD') item.startTime = dayjs(item.startTime).format('YYYY-MM-DD')
item.endTime = dayjs(item.endTime).format('YYYY-MM-DD') item.endTime = dayjs(item.endTime).format('YYYY-MM-DD')
if (this.isClone) { if (this.isClone) {
console.log(this.taskDateNum)
let activityDays = this.getDateByDays(item.startTime, item.endTime) let activityDays = this.getDateByDays(item.startTime, item.endTime)
if (activityDays != this.taskDateNum) { if (activityDays != this.taskDateNum) {
item.taskStatus = 1 item.taskStatus = 1
} }
} }
}) })
console.log(this.activityData, 'this.activityData')
}) })
}, },
// 根据日期获取天数 // 根据日期获取天数
...@@ -121,12 +118,10 @@ export default { ...@@ -121,12 +118,10 @@ export default {
return day return day
}, },
handleSelectItem(item) { handleSelectItem(item) {
console.log(item)
this.selectItem = item this.selectItem = item
}, },
// 确认活动 // 确认活动
confirmActivity() { confirmActivity() {
console.log(11)
if (!this.selectItem.id) { if (!this.selectItem.id) {
this.$message({ this.$message({
message: '请选择活动', message: '请选择活动',
......
<template> <template>
<div class="task-box"> <div class="task-box">
<div id="app"></div>
<div class="task-content"> <div class="task-content">
<div class="task-title">基础信息</div> <div class="task-title">基础信息</div>
<!-- 基础信息表单 --> <!-- 基础信息表单 -->
...@@ -16,7 +17,7 @@ ...@@ -16,7 +17,7 @@
size="small" size="small"
:disabled="isEditor" :disabled="isEditor"
> >
<el-option label="1.3存量用户众筹" :value="3"></el-option> <el-option label="1.3 售后直播众筹活动" :value="3"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="商户:" prop="merchantId"> <el-form-item label="商户:" prop="merchantId">
...@@ -58,10 +59,10 @@ ...@@ -58,10 +59,10 @@
placeholder="请选择任务指定人群" placeholder="请选择任务指定人群"
size="small" size="small"
> >
<el-option label="1.0新车权益销售" value="0"></el-option> <el-option label="1.0 新车权益升级" value="0"></el-option>
<el-option label="1.1次新车精品升级" value="1"></el-option> <el-option label="1.1 新车精品升级" value="1"></el-option>
<el-option label="1.2次新车线上转化" value="2"></el-option> <el-option label="1.2 次新车膨胀金活动" value="2"></el-option>
<el-option label="1.3存量用户众筹" value="3"></el-option> <el-option label="1.3 售后直播众筹活动" value="3"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="发放渠道:" prop="channel"> <el-form-item label="发放渠道:" prop="channel">
...@@ -97,7 +98,7 @@ ...@@ -97,7 +98,7 @@
type="primary" type="primary"
size="small" size="small"
@click="addTaskType(item, index)" @click="addTaskType(item, index)"
:disabled="item.timeFlag" :disabled="item.timeFlag || (isEditor && activityStatus == 2)"
>添加</el-button >添加</el-button
> >
<el-alert <el-alert
...@@ -124,9 +125,10 @@ ...@@ -124,9 +125,10 @@
> >
<el-select <el-select
v-model="itm.missonType" v-model="itm.missonType"
placeholder="请选择任务类型:" placeholder="请选择任务类型"
@change="selectTaskType(item, index, itm, index1)" @change="selectTaskType(item, index, itm, index1)"
size="small" size="small"
:disabled="isEditor && activityStatus == 2"
> >
<el-option label="注册认证" :value="1"></el-option> <el-option label="注册认证" :value="1"></el-option>
<el-option label="分享指标" :value="2"></el-option> <el-option label="分享指标" :value="2"></el-option>
...@@ -167,21 +169,42 @@ ...@@ -167,21 +169,42 @@
<el-form-item <el-form-item
:prop="'missionList.' + index1 + '.missionMaterialList'" :prop="'missionList.' + index1 + '.missionMaterialList'"
:rules="taskFormRules.attachmentList" :rules="taskFormRules.attachmentList"
v-if="itm.missonType == 2" v-if="itm.missonType && itm.missonType != 1"
> >
<label slot="label" class="required">分享素材:</label> <label slot="label" class="required">分享素材:</label>
<GLEditor <GLEditor
:key="'missionList' + itm.id + 'welcome'" :id="
ref="welcome" 'missionList' + (itm.taskid || itm.id) + 'welcome'
"
:key="
'missionList' + (itm.taskid || itm.id) + 'welcome'
"
:ref="
'missionList' + (itm.taskid || itm.id) + 'welcome'
"
:form="'customer'" :form="'customer'"
style="line-height: 12px" style="line-height: 12px"
:btnList="btnList" :btnList="btnList"
:previewData="itm.missionMaterialList" :previewData="itm.missionMaterialList"
:linkStatus="itm.linkStatus"
@getEditor="getEditor(item, index, itm, index1)" @getEditor="getEditor(item, index, itm, index1)"
@shareMatrial="shareMatrial" @shareMatrial="shareMatrial"
@getVideoImg="getVideoImg"
></GLEditor> ></GLEditor>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="分享模式:"
:prop="'missionList.' + index1 + '.sharingMethod'"
:rules="taskFormRules.sharingMethod"
v-if="itm.missonType && itm.missonType != 1"
>
<el-checkbox-group v-model="itm.sharingMethod">
<el-checkbox label="1">微信群发</el-checkbox>
<el-checkbox label="2">分享好友</el-checkbox>
<el-checkbox label="3">分享朋友圈</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item
v-if="itm.missonType && itm.missonType != 1" v-if="itm.missonType && itm.missonType != 1"
label="奖励模式:" label="奖励模式:"
:prop="'missionList.' + index1 + '.rewardType'" :prop="'missionList.' + index1 + '.rewardType'"
...@@ -190,6 +213,7 @@ ...@@ -190,6 +213,7 @@
<el-radio-group <el-radio-group
v-model="itm.rewardType" v-model="itm.rewardType"
@change="rewardTypeChange(itm)" @change="rewardTypeChange(itm)"
:disabled="isEditor && activityStatus == 2"
> >
<el-radio :label="1">累计奖励</el-radio> <el-radio :label="1">累计奖励</el-radio>
<el-radio :label="2">排名奖励</el-radio> <el-radio :label="2">排名奖励</el-radio>
...@@ -204,6 +228,7 @@ ...@@ -204,6 +228,7 @@
<el-radio-group <el-radio-group
v-model="itm.rewardCount" v-model="itm.rewardCount"
@change="rewardCountChange(itm)" @change="rewardCountChange(itm)"
:disabled="isEditor && activityStatus == 2"
> >
<el-radio :label="1">单次</el-radio> <el-radio :label="1">单次</el-radio>
<el-radio :label="2">重复累计</el-radio> <el-radio :label="2">重复累计</el-radio>
...@@ -215,20 +240,40 @@ ...@@ -215,20 +240,40 @@
:prop="'missionList.' + index1 + '.triggerValue'" :prop="'missionList.' + index1 + '.triggerValue'"
:rules="taskFormRules.triggerValue" :rules="taskFormRules.triggerValue"
> >
<el-radio-group v-model="itm.triggerValue"> <el-radio-group
v-model="itm.triggerValue"
:disabled="isEditor && activityStatus == 2"
>
<el-radio :label="1">第一名</el-radio> <el-radio :label="1">第一名</el-radio>
<el-radio :label="2">第二名</el-radio> <el-radio :label="2">第二名</el-radio>
<el-radio :label="3">第三名</el-radio> <el-radio :label="3">第三名</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="itm.rewardType == 2"
label="最低指标:"
:prop="'missionList.' + index1 + '.minTriggerValue'"
:rules="taskFormRules.minTriggerValue"
>
<el-input
v-model="itm.minTriggerValue"
type="number"
:min="1"
oninput="value=value.replace(/^0|[^0-9]/g, '')"
size="small"
:disabled="isEditor && activityStatus == 2"
></el-input>
</el-form-item>
<el-form-item
v-if="itm.rewardCount == 2" v-if="itm.rewardCount == 2"
label="重复次数:" label="重复次数:"
:prop="'missionList.' + index1 + '.repeatCount'" :prop="'missionList.' + index1 + '.repeatCount'"
:rules="taskFormRules.repeatCount" :rules="taskFormRules.repeatCount"
> >
<el-input <el-input
:disabled="itm.repeatFlag" :disabled="
itm.repeatFlag || (isEditor && activityStatus == 2)
"
v-model.trim="itm.repeatCount" v-model.trim="itm.repeatCount"
@blur="handleBlur(itm)" @blur="handleBlur(itm)"
type="number" type="number"
...@@ -238,7 +283,8 @@ ...@@ -238,7 +283,8 @@
></el-input> ></el-input>
<el-checkbox <el-checkbox
:disabled=" :disabled="
itm.repeatCount != '' && itm.repeatCount != -1 (itm.repeatCount != '' && itm.repeatCount != -1) ||
(isEditor && activityStatus == 2)
" "
style="margin-left: 8px" style="margin-left: 8px"
v-model="itm.repeatFlag" v-model="itm.repeatFlag"
...@@ -249,6 +295,20 @@ ...@@ -249,6 +295,20 @@
> >
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="itm.rewardType == 1 && itm.rewardCount == 2"
label="最低指标:"
>
<el-input
v-model="itm.minTriggerValue"
type="number"
:min="1"
oninput="value=value.replace(/^0|[^0-9]/g, '')"
size="small"
:disabled="isEditor && activityStatus == 2"
placeholder="默认为从1开始判断循环奖励"
></el-input>
</el-form-item>
<el-form-item
v-if="itm.rewardType == 1" v-if="itm.rewardType == 1"
label="触发值:" label="触发值:"
:prop="'missionList.' + index1 + '.triggerValue'" :prop="'missionList.' + index1 + '.triggerValue'"
...@@ -260,6 +320,7 @@ ...@@ -260,6 +320,7 @@
:min="0" :min="0"
oninput="value=value.replace(/^0|[^0-9]/g, '')" oninput="value=value.replace(/^0|[^0-9]/g, '')"
size="small" size="small"
:disabled="isEditor && activityStatus == 2"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
...@@ -270,6 +331,7 @@ ...@@ -270,6 +331,7 @@
<el-input <el-input
v-model="itm.rewardScore" v-model="itm.rewardScore"
size="small" size="small"
:disabled="isEditor && activityStatus == 2"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</div> </div>
...@@ -277,7 +339,9 @@ ...@@ -277,7 +339,9 @@
<el-button <el-button
type="text" type="text"
@click="delTask(item, index, itm, index1)" @click="delTask(item, index, itm, index1)"
:disabled="item.timeFlag" :disabled="
item.timeFlag || (isEditor && activityStatus == 2)
"
>删除</el-button >删除</el-button
> >
</div> </div>
...@@ -348,6 +412,7 @@ export default { ...@@ -348,6 +412,7 @@ export default {
repeatChecked: false, repeatChecked: false,
// 子组件传来的分享素材 // 子组件传来的分享素材
shareEditor: '', shareEditor: '',
videoImg: '',
// 是否是编辑 // 是否是编辑
isEditor: false, isEditor: false,
// 是否是克隆 // 是否是克隆
...@@ -356,8 +421,12 @@ export default { ...@@ -356,8 +421,12 @@ export default {
activityDiaVisible: false, activityDiaVisible: false,
// 活动日期天数 // 活动日期天数
taskDateNum: 0, taskDateNum: 0,
// 商户加载
merchantLoading: false, merchantLoading: false,
// 验证表单天(判断哪一天未填写完成)
dayIndex: 0, dayIndex: 0,
// 活动状态
activityStatus: '',
btnList: [ btnList: [
{ {
name: '表情', name: '表情',
...@@ -376,19 +445,14 @@ export default { ...@@ -376,19 +445,14 @@ export default {
name: '视频', name: '视频',
funcName: '', funcName: '',
type: 'video', type: 'video',
limitSize: 10, // 限制视频大小 // limitSize: 10, // 限制视频大小
// togetherItem: [ATT_TYPE.TEXT], // 只允许文本和图片
limitNum: 1, // 限制视频数量 limitNum: 1, // 限制视频数量
// limitWidth: 1280, // 限制视频宽度
// limitHeight: 720, // 限制视频高度
// limitTime: 30, // 限制视频时长
uploadApi: commonApi.uploadImgApi, uploadApi: commonApi.uploadImgApi,
}, },
{ {
name: '活动专属链接', name: '活动专属链接',
funcName: 'link', funcName: 'link',
type: 'link', type: 'link',
// uploadApi: this.$apis.common.pictureUpload
}, },
], ],
// 任务计划 // 任务计划
...@@ -403,7 +467,7 @@ export default { ...@@ -403,7 +467,7 @@ export default {
activityImage: '', activityImage: '',
// 公共任务类型 // 公共任务类型
basicObj: { basicObj: {
id: '', taskid: '',
missonType: '', missonType: '',
missionName: '', missionName: '',
missonDesc: '', missonDesc: '',
...@@ -415,23 +479,34 @@ export default { ...@@ -415,23 +479,34 @@ export default {
rewardType: '', rewardType: '',
rewardCount: '', rewardCount: '',
triggerValue: '', triggerValue: '',
minTriggerValue: '',
sharingMethod: [],
}, },
// 浏览指标任务类型 // 浏览指标任务类型
browseObj: { browseObj: {
missionMaterialList: [],
rewardType: '', rewardType: '',
rewardCount: '', rewardCount: '',
repeatCount: '', repeatCount: '',
triggerValue: '', triggerValue: '',
minTriggerValue: '',
sharingMethod: [],
}, },
// 访客指标任务类型 // 访客指标任务类型
visitorObj: { visitorObj: {
missionMaterialList: [],
rewardType: '', rewardType: '',
triggerValue: '', triggerValue: '',
minTriggerValue: '',
sharingMethod: [],
}, },
// 成单指标任务类型 // 成单指标任务类型
orderObj: { orderObj: {
missionMaterialList: [],
rewardType: '', rewardType: '',
triggerValue: '', triggerValue: '',
minTriggerValue: '',
sharingMethod: [],
}, },
// 编辑任务计划数据 // 编辑任务计划数据
taskEditList: {}, taskEditList: {},
...@@ -479,13 +554,16 @@ export default { ...@@ -479,13 +554,16 @@ export default {
triggerValue: [ triggerValue: [
{ required: true, message: '请输入触发值', trigger: 'blur' }, { required: true, message: '请输入触发值', trigger: 'blur' },
], ],
minTriggerValue: [
{ required: true, message: '请输入最低指标', trigger: 'blur' },
],
rewardScore: [ rewardScore: [
{ required: true, trigger: 'blur', validator: validateAwardIntegral }, { required: true, trigger: 'blur', validator: validateAwardIntegral },
], ],
attachmentList: [ sharingMethod: [
{ required: true, message: '请输入入群欢迎语' }, { required: true, trigger: 'change', message: '请选择分享模式' },
// { validator: validatorAttachment, trigger: 'change' }
], ],
attachmentList: [{ required: true, message: '请输入分享素材' }],
}, },
} }
}, },
...@@ -529,7 +607,6 @@ export default { ...@@ -529,7 +607,6 @@ export default {
this.isClone, this.isClone,
this.taskDateNum this.taskDateNum
) )
// this.$refs.activityDia.init(44209390)
}, },
// 选择商户 // 选择商户
selectMerchant(query) { selectMerchant(query) {
...@@ -544,12 +621,20 @@ export default { ...@@ -544,12 +621,20 @@ export default {
let params = {} let params = {}
params.merchantAccountType = 4 params.merchantAccountType = 4
params.merchantName = query params.merchantName = query
taskApi.findMerchantByScene(params).then((res) => { taskApi.findMerchantByScene(params).then(
(res) => {
if (res.code == 0) { if (res.code == 0) {
this.merchantList = res.data this.merchantList = res.data
} }
this.merchantLoading = false this.merchantLoading = false
},
(err) => {
this.$message({
message: err,
type: 'error',
}) })
}
)
}, },
// 商户改变获取商户名 // 商户改变获取商户名
changeMerchant(val) { changeMerchant(val) {
...@@ -606,7 +691,6 @@ export default { ...@@ -606,7 +691,6 @@ export default {
this.taskList = [] this.taskList = []
startTime = new Date(startTime) startTime = new Date(startTime)
endTime = new Date(endTime) endTime = new Date(endTime)
let num = 0
while (endTime.getTime() - startTime.getTime() >= 0) { while (endTime.getTime() - startTime.getTime() >= 0) {
const year = startTime.getFullYear() const year = startTime.getFullYear()
const month = const month =
...@@ -621,7 +705,6 @@ export default { ...@@ -621,7 +705,6 @@ export default {
activityTime: `${year}-${month}-${day}`, activityTime: `${year}-${month}-${day}`,
missionList: [], missionList: [],
}) })
num++
startTime.setDate(startTime.getDate() + 1) startTime.setDate(startTime.getDate() + 1)
} }
// 多添加一个完整周期tab // 多添加一个完整周期tab
...@@ -630,15 +713,19 @@ export default { ...@@ -630,15 +713,19 @@ export default {
missionList: [], missionList: [],
}) })
// 如果是编辑/复制页面,任务计划回显 // 如果是编辑/复制页面,任务计划回显
if (this.isEditor || this.isClone) this.dealEcho() if (this.isEditor || (this.isClone && !this.basicForm.activityName))
// 如果是如果是编辑/新建页面,还需处理当前日期之前是否可编辑处理 this.dealEcho()
if (!this.isClone) this.getEditTaskList() if (this.isClone && this.basicForm.activityName) this.dealEcho(1)
// 处理当前日期之前是否可编辑处理
this.getEditTaskList()
// 如果是克隆,还需处理克隆时间 // 如果是克隆,还需处理克隆时间
if (this.isClone && !this.basicForm.activityName) this.getCloneTaskList() if (this.isClone && !this.basicForm.activityName) this.getCloneTaskList()
this.cloneList = this.taskList
return this.taskList return this.taskList
}, },
// 处理任务计划回显 // 处理任务计划回显
dealEcho() { dealEcho(val) {
if (!val) {
for (var i = 0; i < this.taskList.length; i++) { for (var i = 0; i < this.taskList.length; i++) {
for (var j = 0; j < this.taskEditList.missionDateList.length; j++) { for (var j = 0; j < this.taskEditList.missionDateList.length; j++) {
if ( if (
...@@ -650,6 +737,11 @@ export default { ...@@ -650,6 +737,11 @@ export default {
} }
} }
} }
} else {
this.cloneList.forEach((item, index) => {
this.taskList[index].missionList = item.missionList
})
}
}, },
// 根据日期获取天数 // 根据日期获取天数
getDateByDays(startDate, endDdate) { getDateByDays(startDate, endDdate) {
...@@ -661,11 +753,13 @@ export default { ...@@ -661,11 +753,13 @@ export default {
}, },
// 添加任务 // 添加任务
addTaskType(item, index) { addTaskType(item, index) {
if (this.videoImg) {
this.videoImg = ''
}
this.taskList[index].missionList.unshift({ this.taskList[index].missionList.unshift({
...this.basicObj, ...this.basicObj,
}) })
this.taskList[index].missionList[0].id = this.getUuid() this.taskList[index].missionList[0].taskid = this.getUuid()
console.log(this.taskList[index].missionList[0])
}, },
// 任务选择类型切换 // 任务选择类型切换
selectTaskType(dateTask, dateTaskIndex, task, taskIndex) { selectTaskType(dateTask, dateTaskIndex, task, taskIndex) {
...@@ -694,28 +788,43 @@ export default { ...@@ -694,28 +788,43 @@ export default {
// 判断任务类型,将任务类型参数push进taskList // 判断任务类型,将任务类型参数push进taskList
let taskItem let taskItem
switch (task.missonType) { switch (task.missonType) {
case '1': case 1:
taskItem = { ...this.basicObj } taskItem = Object.assign({}, this.basicObj)
break break
case '2': case 2:
taskItem = { ...this.basicObj, ...this.shareObj } taskItem = Object.assign({}, this.basicObj, this.shareObj)
break break
case '3': case 3:
taskItem = { ...this.basicObj, ...this.browseObj } taskItem = Object.assign({}, this.basicObj, this.browseObj)
break break
case '4': case 4:
taskItem = { ...this.basicObj, ...this.visitorObj } taskItem = Object.assign({}, this.basicObj, this.visitorObj)
break break
case '5': case 5:
taskItem = { ...this.basicObj, ...this.orderObj } taskItem = Object.assign({}, this.basicObj, this.orderObj)
break break
default: default:
taskItem = { ...this.basicObj } taskItem = { ...this.basicObj }
} }
// 沿用任务名称以及id
taskItem.missonType = task.missonType taskItem.missonType = task.missonType
taskItem.id = task.id taskItem.taskid = task.taskid
// 任务类型=浏览、访客、成单时,默认添加活动专属链接
if (taskItem.missonType != 1 && taskItem.missonType != 2) {
taskItem.linkStatus = true
} else {
taskItem.linkStatus = false
}
this.$nextTick(() => {
this.$set(this.taskList[dateTaskIndex].missionList, taskIndex, taskItem) this.$set(this.taskList[dateTaskIndex].missionList, taskIndex, taskItem)
console.log(this.taskList[dateTaskIndex].missionList) var box = document.getElementById(
'missionList' + task.taskid + 'welcome'
)
if (box) {
var editName = 'missionList' + task.taskid + 'welcome'
this.$refs[editName][0].resetItem()
}
})
}, },
// 获取分享素材内容 // 获取分享素材内容
getEditor(dateTask, dateTaskIndex, task, taskIndex) { getEditor(dateTask, dateTaskIndex, task, taskIndex) {
...@@ -728,10 +837,28 @@ export default { ...@@ -728,10 +837,28 @@ export default {
'missionMaterialList', 'missionMaterialList',
this.shareEditor this.shareEditor
) )
console.log(this.videoImg)
if (this.videoImg) {
// 找到视频下标
const videoFlag = this.taskList[dateTaskIndex].missionList[
taskIndex
].missionMaterialList.findIndex((item) => {
return item.materialType == 3
})
this.$set(
this.taskList[dateTaskIndex].missionList[taskIndex]
.missionMaterialList[videoFlag],
'firstFrameUrl',
this.videoImg
)
}
console.log(this.taskList[dateTaskIndex].missionList[taskIndex])
}, },
shareMatrial(val) { shareMatrial(val) {
this.shareEditor = val this.shareEditor = val
// this.getEditor() },
getVideoImg(val) {
this.videoImg = val
}, },
// 删除任务 // 删除任务
delTask(dateTask, dateTaskIndex, task, taskIndex) { delTask(dateTask, dateTaskIndex, task, taskIndex) {
...@@ -749,10 +876,7 @@ export default { ...@@ -749,10 +876,7 @@ export default {
}, },
// 重复次数选择框改变 // 重复次数选择框改变
repeatChange(listindex, dateTask, type, taskIndex) { repeatChange(listindex, dateTask, type, taskIndex) {
// dateTask.repeatFlag = !dateTask.repeatFlag
// this.$nextTick(() => {
if (type) { if (type) {
// dateTask.repeatCount = -1
// 去除校验 // 去除校验
this.$refs['taskForm'][listindex].fields.map((i) => { this.$refs['taskForm'][listindex].fields.map((i) => {
if (i.prop === 'missionList.' + taskIndex + '.repeatCount') { if (i.prop === 'missionList.' + taskIndex + '.repeatCount') {
...@@ -760,42 +884,17 @@ export default { ...@@ -760,42 +884,17 @@ export default {
} }
}) })
} else { } else {
// this.$nextTick(() => {
// dateTask.repeatCount = ''
// dateTask.repeatFlag = false
// })
this.$nextTick(() => { this.$nextTick(() => {
dateTask.repeatCount = '' dateTask.repeatCount = ''
this.$set(dateTask, 'repeatFlag', false) this.$set(dateTask, 'repeatFlag', false)
}) })
} }
// })
// // dateTask -- 具体哪一天的任务对象
// // dateTaskIndex -- 具体哪一天的任务对象索引
// // task -- 具体哪个任务
// // taskIndex -- 具体任务索引
// if (task.repeatCount) {
// // this.taskList[dateTaskIndex].missionList[taskIndex].repeatCount = ''
// this.$set(
// this.taskList[dateTaskIndex].missionList[taskIndex],
// 'repeatCount',
// ''
// )
// } else {
// // this.taskList[dateTaskIndex].missionList[taskIndex].repeatCount = -1
// this.$set(
// this.taskList[dateTaskIndex].missionList[taskIndex],
// 'repeatCount',
// -1
// )
// }
}, },
// 获取任务信息详情 // 获取任务信息详情
findMissionDeail(taskId) { findMissionDeail(taskId) {
var params = { id: taskId } var params = { id: taskId }
taskApi.findMissionDeail(params).then((res) => { taskApi.findMissionDeail(params).then(
(res) => {
if (res && res.code == 0) { if (res && res.code == 0) {
const { const {
activityId, activityId,
...@@ -808,6 +907,7 @@ export default { ...@@ -808,6 +907,7 @@ export default {
merchantName, merchantName,
startTime, startTime,
endTime, endTime,
activityStatus,
} = res.data } = res.data
this.basicForm.activityId = this.isEditor ? activityId : '' this.basicForm.activityId = this.isEditor ? activityId : ''
this.basicForm.activityName = this.isEditor ? activityName : '' this.basicForm.activityName = this.isEditor ? activityName : ''
...@@ -819,40 +919,62 @@ export default { ...@@ -819,40 +919,62 @@ export default {
this.basicForm.merchantName = merchantName this.basicForm.merchantName = merchantName
this.startTime = startTime this.startTime = startTime
this.endTime = endTime this.endTime = endTime
this.activityStatus = activityStatus
this.taskEditList = res.data this.taskEditList = res.data
// 处理空素材数据 // 处理空素材数据
this.taskEditList.missionDateList.map((item) => { this.taskEditList.missionDateList.map((item) => {
item.missionList.map((itm) => { item.missionList.map((itm) => {
if (
itm.missonType &&
itm.missonType != 1 &&
itm.missonType != 2
) {
itm.linkStatus = true
} else {
itm.linkStatus = false
}
if (!itm.missionMaterialList) { if (!itm.missionMaterialList) {
delete itm.missionMaterialList delete itm.missionMaterialList
} }
// 处理重复次数
if (itm.repeatCount && itm.repeatCount == -1) { if (itm.repeatCount && itm.repeatCount == -1) {
this.$set(itm, 'repeatFlag', true) this.$set(itm, 'repeatFlag', true)
itm.repeatCount = '' itm.repeatCount = ''
} }
// 处理分享模式
if (itm.sharingMethod) {
itm.sharingMethod = itm.sharingMethod.split(',')
} else {
itm.sharingMethod = []
}
}) })
}) })
// this.taskList = res.data.missionDateList
this.setHouseRatesColumn(startTime, endTime) this.setHouseRatesColumn(startTime, endTime)
if (this.isClone) { if (this.isClone) {
this.taskDateNum = this.getDateByDays(startTime, endTime) this.taskDateNum = this.getDateByDays(startTime, endTime)
} }
} }
},
(err) => {
this.$message({
message: err,
type: 'error',
}) })
}
)
}, },
// 奖励模式切换 // 奖励模式切换
rewardTypeChange(itm) { rewardTypeChange(itm) {
console.log(itm)
if (itm.rewardType == 2) { if (itm.rewardType == 2) {
this.$nextTick(() => { this.$nextTick(() => {
this.$set(itm, 'triggerValue', '') this.$set(itm, 'triggerValue', '')
this.$set(itm, 'rewardCount', '') this.$set(itm, 'rewardCount', '')
// itm.triggerValue = '' this.$set(itm, 'minTriggerValue', '1')
}) })
} else { } else {
this.$nextTick(() => { this.$nextTick(() => {
this.$set(itm, 'rewardCount', 1) this.$set(itm, 'rewardCount', '')
// itm.rewardCount = '' this.$set(itm, 'minTriggerValue', '1')
}) })
} }
}, },
...@@ -860,16 +982,14 @@ export default { ...@@ -860,16 +982,14 @@ export default {
rewardCountChange(itm) { rewardCountChange(itm) {
if (itm.rewardCount == 2) { if (itm.rewardCount == 2) {
this.$nextTick(() => { this.$nextTick(() => {
this.$set(itm, 'minTriggerValue', '1')
this.$set(itm, 'repeatCount', '') this.$set(itm, 'repeatCount', '')
this.$set(itm, 'triggerValue', '') this.$set(itm, 'triggerValue', '')
// itm.repeatCount = ''
// itm.triggerValue = ''
}) })
} else { } else {
this.$nextTick(() => { this.$nextTick(() => {
this.$set(itm, 'triggerValue', '') this.$set(itm, 'triggerValue', '')
// itm.triggerValue = '' this.$set(itm, 'minTriggerValue', '')
}) })
} }
}, },
...@@ -877,32 +997,21 @@ export default { ...@@ -877,32 +997,21 @@ export default {
basicFormValidate() { basicFormValidate() {
this.$refs['basicForm'].validate((valid) => { this.$refs['basicForm'].validate((valid) => {
if (!valid) { if (!valid) {
// return all
throw '必须选定一个值' throw '必须选定一个值'
} }
}) })
}, },
// 任务计划表单验证 // 任务计划表单验证
taskFormValidate() { taskFormValidate() {
// var validFlag = 0
// var dayIndex = 0
this.taskList.map((item, index) => { this.taskList.map((item, index) => {
this.$refs['taskForm'][index].validate((valid) => { this.$refs['taskForm'][index].validate((valid) => {
console.log(valid)
// if (!valid) validFlag = validFlag + 1
if (!valid) { if (!valid) {
console.log(111)
this.validFlag = false this.validFlag = false
this.dayIndex = index this.dayIndex = index
return return
} }
}) })
// 检测到未填写跳转到未填写页面
}) })
// if (validFlag > 0) {
// return [validFlag, dayIndex]
// }
}, },
// 任务计划是否为空验证 // 任务计划是否为空验证
taskFormEmptyValidate() { taskFormEmptyValidate() {
...@@ -920,14 +1029,27 @@ export default { ...@@ -920,14 +1029,27 @@ export default {
}, },
// 提交任务 // 提交任务
submitTask() { submitTask() {
// 遍历重复次数 // 遍历
this.taskList.map((item) => { this.taskList.map((item) => {
item.missionList.map((itm) => { item.missionList.map((itm) => {
// itm.repeatCount = itm.repeatCount ? itm.repeatCount : -1 // 重复次数处理
if (itm.repeatCount || itm.repeatFlag) { if (itm.repeatCount || itm.repeatFlag) {
itm.repeatCount = itm.repeatCount ? itm.repeatCount : -1 itm.repeatCount = itm.repeatCount ? itm.repeatCount : -1
} }
delete itm.id // 最低指标处理
if (
itm.rewardType == 1 &&
itm.rewardCount == 2 &&
!itm.minTriggerValue
) {
itm.minTriggerValue = 1
}
// 分享模式处理
if (itm.sharingMethod) {
itm.sharingMethod = itm.sharingMethod.toString()
}
// 自定义uuid删除
delete itm.taskid
}) })
}) })
try { try {
...@@ -960,9 +1082,11 @@ export default { ...@@ -960,9 +1082,11 @@ export default {
} }
params.missionDateList = this.taskList params.missionDateList = this.taskList
params.id = this.taskId params.id = this.taskId
console.log(params, 'params')
// 创建 // 创建
if (!this.isEditor) { if (!this.isEditor) {
taskApi.creatMission(params).then((res) => { taskApi.creatMission(params).then(
(res) => {
if (res && res.code == 0) { if (res && res.code == 0) {
this.$root.to([ this.$root.to([
'任务中心', '任务中心',
...@@ -972,17 +1096,20 @@ export default { ...@@ -972,17 +1096,20 @@ export default {
'任务管理列表', '任务管理列表',
]) ])
this.$root.close('*添加任务模板') this.$root.close('*添加任务模板')
} else { }
},
(err) => {
this.$message({ this.$message({
message: res.message, message: err,
type: 'error', type: 'error',
}) })
} }
}) )
return return
} }
// 编辑 // 编辑
taskApi.updateMission(params).then((res) => { taskApi.updateMission(params).then(
(res) => {
if (res && res.code == 0) { if (res && res.code == 0) {
this.$root.to([ this.$root.to([
'任务中心', '任务中心',
...@@ -992,26 +1119,18 @@ export default { ...@@ -992,26 +1119,18 @@ export default {
'任务管理列表', '任务管理列表',
]) ])
this.$root.close('*添加任务模板') this.$root.close('*添加任务模板')
} else { }
},
(err) => {
this.$message({ this.$message({
message: res.message, message: err,
type: 'error', type: 'error',
}) })
} }
}) )
}, },
// 取消s // 取消
cancelSubmit() { cancelSubmit() {
;(this.basicForm = {
businessScene: 3,
merchantId: '',
merchantName: '',
activityId: '',
activityName: '',
crowd: ['3'],
channel: 1,
remark: '',
}),
this.$root.to([ this.$root.to([
'任务中心', '任务中心',
'任务平台', '任务平台',
......
<template> <template>
<div> <div>
<div class='taskDetails' v-for='(item,index) in taskDetails' :key='index'> <div class="taskDetails" v-for="(item, index) in taskDetails" :key="index">
<div class='leftContent'> <div class="leftContent">
<p>{{ item.missonTypeName }}</p> <p>{{ item.missonTypeName }}</p>
<p>{{ item.missionName }}</p> <p>{{ item.missionName }}</p>
<p>{{ item.missonDesc }}</p> <p>{{ item.missonDesc }}</p>
<template v-if='item.platformMerchantMissionMaterialResponseList && item.platformMerchantMissionMaterialResponseList.length'> <template
<div v-for='(sub,idx,) in item.platformMerchantMissionMaterialResponseList' :key='idx'> v-if="
item.platformMerchantMissionMaterialResponseList &&
item.platformMerchantMissionMaterialResponseList.length
"
>
<div
v-for="(
sub, idx
) in item.platformMerchantMissionMaterialResponseList"
:key="idx"
>
<template v-if="sub.materialType == '1'"> <template v-if="sub.materialType == '1'">
<p v-html='tramWord(sub.materialContent)'></p> <p v-html="tramWord(sub.materialContent)"></p>
</template> </template>
<template v-if="sub.materialType == '2'"> <template v-if="sub.materialType == '2'">
<img class='displayImg' :src='sub.materialContent'> <img class="displayImg" :src="sub.materialContent" />
</template> </template>
<template v-if="sub.materialType == '3'"> <template v-if="sub.materialType == '3'">
<video class='displayImg' :src='sub.materialContent' /> <video class="displayImg" controls='controls' :src="sub.materialContent" />
</template> </template>
<template v-if="sub.materialType == '4'"> <template v-if="sub.materialType == '4'">
<p class='content'>{{sub.materialContent}}</p> <p class="content">{{ sub.materialContent }}</p>
</template> </template>
</div> </div>
</template> </template>
<div class='taskAward'> <div class="taskAward">
<div class='showInfoForm'> <div class="showInfoForm">
<span v-if='item.rewardTypeName'>奖励模式:{{ item.rewardTypeName }}</span> <span v-if="item.rewardTypeName"
<span v-if='item.rewardCountName'>奖励次数:{{ item.rewardCountName }}</span> >奖励模式:{{ item.rewardTypeName }}</span
>
<span v-if="item.rewardCountName"
>奖励次数:{{ item.rewardCountName }}</span
>
<span v-if="item.rewardCountName == '重复累计'"> <span v-if="item.rewardCountName == '重复累计'">
重复次数:{{ item.repeatCount == '-1' ? '无限制' : item.repeatCount }} 重复次数:{{
item.repeatCount == '-1' ? '无限制' : item.repeatCount
}}
</span> </span>
<span v-if='item.triggerValue'>触发值:{{ item.triggerValue }}</span> <span v-if="item.sharingMethod"
<span v-if='item.rewardScore'>奖励积分值:{{ item.rewardScore }}</span> >分享模式:{{ item.sharingMethod == '1'?'微信群发': item.sharingMethod == '2'? '分享好友' :item.sharingMethod == '3'?'分享朋友圈' :''}}</span
>
<span v-if="item.triggerValue"
>触发值:{{ item.triggerValue }}</span
>
<span v-if="item.rewardScore"
>奖励积分值:{{ item.rewardScore }}</span
>
<span v-if="item.minTriggerValue"
>最低指标:{{ item.minTriggerValue }}</span
>
</div> </div>
</div> </div>
</div> </div>
<div v-if="item.missonType != '1'" class='copyLine' id='copy' v-on:click='copy(item.id)'> <div
v-if="item.missonType != '1'"
class="copyLine"
id="copy"
v-on:click="copy(item.id)"
>
复制任务提醒链接 复制任务提醒链接
</div> </div>
</div> </div>
...@@ -48,15 +79,17 @@ export default { ...@@ -48,15 +79,17 @@ export default {
props: { props: {
taskDetails: { taskDetails: {
type: Array, type: Array,
default: [] default: [],
} },
}, },
data() { data() {
return {} return {}
}, },
methods: { methods: {
tramWord(val) { tramWord(val) {
let htm = val.replace(/\[([\u4E00-\u9FA56]{1,4}|OK|NO|666)]/gi, function(res) { let htm = val.replace(
/\[([\u4E00-\u9FA56]{1,4}|OK|NO|666)]/gi,
function (res) {
let word = res.replace(/\[|\]/gi, '') let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity) const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1 let index = parseInt(list.indexOf(word)) + 1
...@@ -66,11 +99,14 @@ export default { ...@@ -66,11 +99,14 @@ export default {
index = '0' + index index = '0' + index
} }
return `<img style='width:25px;height:25px' src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">` return `<img style='width:25px;height:25px' src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
}) }
)
return htm return htm
}, },
async copy(id) { async copy(id) {
await taskManagementApi.getStaffMissionLink({ missionId: id }).then(res => { await taskManagementApi
.getStaffMissionLink({ missionId: id })
.then((res) => {
if (res.code == '0' && res.data) { if (res.code == '0' && res.data) {
var input = document.createElement('input') var input = document.createElement('input')
input.value = res.data input.value = res.data
...@@ -83,8 +119,8 @@ export default { ...@@ -83,8 +119,8 @@ export default {
this.$message.error('复制失败!') this.$message.error('复制失败!')
} }
}) })
} },
} },
} }
</script> </script>
...@@ -97,10 +133,10 @@ export default { ...@@ -97,10 +133,10 @@ export default {
padding: 20px; padding: 20px;
margin-bottom: 20px; margin-bottom: 20px;
} }
.leftContent{ .leftContent {
width: 70%; width: 70%;
} }
.content{ .content {
height: auto; height: auto;
word-wrap: break-word; word-wrap: break-word;
word-break: break-all; word-break: break-all;
...@@ -110,7 +146,6 @@ export default { ...@@ -110,7 +146,6 @@ export default {
justify-content: space-between; justify-content: space-between;
} }
.showInfoForm { .showInfoForm {
margin-top: 10px; margin-top: 10px;
width: 700px; width: 700px;
...@@ -122,10 +157,10 @@ export default { ...@@ -122,10 +157,10 @@ export default {
width: 50%; width: 50%;
} }
.copyLine { .copyLine {
color: #409EFF; color: #409eff;
cursor: pointer; cursor: pointer;
} }
.displayImg{ .displayImg {
width: 500px; width: 500px;
height: 300px; height: 300px;
} }
......
<template> <template>
<div class='taskPlan'> <div class="taskPlan">
<div class='headline'>任务计划</div> <div class="headline">任务计划</div>
<el-tabs v-model='activeName' type='card'> <el-tabs v-model="activeName" type="card">
<el-tab-pane v-for='(item,index) in taskPlanList' :key='index' <el-tab-pane
:label="item.activityTime =='-1'?'完整周期' : item.activityTime" :name='item.activityTime'> v-for="(item, index) in taskPlanList"
<div class='taskInfo' v-for='(displayList,idx) in item.platformMerchantMissionResponseList' :key='idx'> :key="index"
<p class='taskType'>{{ displayList.missonTypeName }}</p> :label="item.activityTime == '-1' ? '完整周期' : item.activityTime"
:name="item.activityTime"
>
<div
class="taskInfo"
v-for="(displayList, idx) in item.platformMerchantMissionResponseList"
:key="idx"
>
<p class="taskType">{{ displayList.missonTypeName }}</p>
<p>{{ displayList.missionName }}</p> <p>{{ displayList.missionName }}</p>
<p>{{ displayList.missonDesc }}</p> <p>{{ displayList.missonDesc }}</p>
<template <template
v-if='displayList.platformMerchantMissionMaterialResponseList && displayList.platformMerchantMissionMaterialResponseList.length'> v-if="
<div v-for='(sub,idx,) in displayList.platformMerchantMissionMaterialResponseList' :key='idx'> displayList.platformMerchantMissionMaterialResponseList &&
displayList.platformMerchantMissionMaterialResponseList.length
"
>
<div
v-for="(
sub, idx
) in displayList.platformMerchantMissionMaterialResponseList"
:key="idx"
>
<template v-if="sub.materialType == '1'"> <template v-if="sub.materialType == '1'">
<p v-html='tramWord(sub.materialContent)'></p> <p v-html="tramWord(sub.materialContent)"></p>
</template> </template>
<template v-if="sub.materialType == '2'"> <template v-if="sub.materialType == '2'">
<img class='displayImg' :src='sub.materialContent'> <img class="displayImg" :src="sub.materialContent" />
</template> </template>
<template v-if="sub.materialType == '3'"> <template v-if="sub.materialType == '3'">
<video class='displayImg' :src='sub.materialContent' /> <video class="displayImg" controls='controls' :src="sub.materialContent" />
</template> </template>
<template v-if="sub.materialType == '4'"> <template v-if="sub.materialType == '4'">
<p>{{ sub.materialContent }}</p> <p>{{ sub.materialContent }}</p>
</template> </template>
</div> </div>
</template> </template>
<div class='showInfoForm'> <div class="showInfoForm">
<span v-if='displayList.rewardTypeName'>奖励模式:{{ displayList.rewardTypeName }}</span> <span v-if="displayList.rewardTypeName"
<span v-if='displayList.rewardCountName'>奖励次数:{{ displayList.rewardCountName }}</span> >奖励模式:{{ displayList.rewardTypeName }}</span
>
<span v-if="displayList.rewardCountName"
>奖励次数:{{ displayList.rewardCountName }}</span
>
<span v-if="displayList.rewardCountName == '重复累计'"> <span v-if="displayList.rewardCountName == '重复累计'">
重复次数:{{ displayList.repeatCount == '-1' ? '无限制' : displayList.repeatCount }} 重复次数:{{
displayList.repeatCount == '-1'
? '无限制'
: displayList.repeatCount
}}
</span> </span>
<span v-if='displayList.triggerValue'>触发值:{{ displayList.triggerValue }}</span> <span v-if="displayList.sharingMethod"
<span v-if='displayList.rewardScore'>奖励积分值:{{ displayList.rewardScore }}</span> >分享模式:{{ displayList.sharingMethod == '1'?'微信群发': displayList.sharingMethod == '2'? '分享好友' :displayList.sharingMethod == '3'?'分享朋友圈' :''}}</span
>
<span v-if="displayList.triggerValue"
>触发值:{{ displayList.triggerValue }}</span
>
<span v-if="displayList.rewardScore"
>奖励积分值:{{ displayList.rewardScore }}</span
>
<span v-if="displayList.minTriggerValue"
>最低指标:{{ displayList.minTriggerValue }}</span
>
</div> </div>
</div> </div>
</el-tab-pane> </el-tab-pane>
...@@ -49,29 +84,31 @@ export default { ...@@ -49,29 +84,31 @@ export default {
props: { props: {
taskPlanList: { taskPlanList: {
type: Array, type: Array,
default: [] default: [],
} },
}, },
data() { data() {
return { return {
activeName: '' activeName: '',
} }
}, },
watch: { watch: {
taskPlanList:{ taskPlanList: {
handler(newVal,oldVal){ handler(newVal, oldVal) {
if (!oldVal || newVal !== oldVal) { if (!oldVal || newVal !== oldVal) {
this.activeName = newVal && newVal[0].activityTime this.activeName = newVal && newVal[0].activityTime
this.taskPlanList = newVal this.taskPlanList = newVal
} }
}, },
immediate: true, immediate: true,
deep: true deep: true,
}
}, },
methods:{ },
methods: {
tramWord(val) { tramWord(val) {
let htm = val.replace(/\[([\u4E00-\u9FA56]{1,4}|OK|NO|666)]/gi, function(res) { let htm = val.replace(
/\[([\u4E00-\u9FA56]{1,4}|OK|NO|666)]/gi,
function (res) {
let word = res.replace(/\[|\]/gi, '') let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity) const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1 let index = parseInt(list.indexOf(word)) + 1
...@@ -81,15 +118,16 @@ export default { ...@@ -81,15 +118,16 @@ export default {
index = '0' + index index = '0' + index
} }
return `<img style='width:25px;height:25px' src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">` return `<img style='width:25px;height:25px' src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
}) }
)
return htm return htm
}, },
} },
} }
</script> </script>
<style scoped> <style scoped>
.taskPlan{ .taskPlan {
margin-top: 20px; margin-top: 20px;
} }
.headline { .headline {
...@@ -98,7 +136,7 @@ export default { ...@@ -98,7 +136,7 @@ export default {
} }
.taskInfo { .taskInfo {
border: 1px solid #E4E7ED; border: 1px solid #e4e7ed;
padding-left: 20px; padding-left: 20px;
padding-right: 20px; padding-right: 20px;
margin-bottom: 16px; margin-bottom: 16px;
...@@ -110,7 +148,7 @@ export default { ...@@ -110,7 +148,7 @@ export default {
.displayImg { .displayImg {
width: 500px; width: 500px;
height: 300px height: 300px;
} }
.showInfoForm { .showInfoForm {
......
...@@ -59,10 +59,14 @@ ...@@ -59,10 +59,14 @@
:pageConf="pageConf" :pageConf="pageConf"
> >
<div slot="businessScene" slot-scope="scope"> <div slot="businessScene" slot-scope="scope">
<span v-if="scope.scope.businessScene == 0">1.0新车权益销售</span> <span v-if="scope.scope.businessScene == 0">1.0 新车权益升级</span>
<span v-if="scope.scope.businessScene == 1">1.1次新车精品升级</span> <span v-if="scope.scope.businessScene == 1">1.1 新车精品升级</span>
<span v-if="scope.scope.businessScene == 2">1.2次新车线上转化</span> <span v-if="scope.scope.businessScene == 2"
<span v-if="scope.scope.businessScene == 3">1.3存量用户众筹</span> >1.2 次新车膨胀金活动</span
>
<span v-if="scope.scope.businessScene == 3"
>1.3 售后直播众筹活动</span
>
</div> </div>
<div slot="activityStatus" slot-scope="scope"> <div slot="activityStatus" slot-scope="scope">
<span v-if="scope.scope.activityStatus == statusNum.UNPUBLISH" <span v-if="scope.scope.activityStatus == statusNum.UNPUBLISH"
...@@ -78,7 +82,7 @@ ...@@ -78,7 +82,7 @@
<template slot="auth-button" slot-scope="scope"> <template slot="auth-button" slot-scope="scope">
<el-button <el-button
type="text" type="text"
v-if="scope.scope.activityStatus == statusNum.UNPUBLISH" v-if="scope.scope.activityStatus != statusNum.FINISHIED"
@click="handleEdit(scope.scope, 1)" @click="handleEdit(scope.scope, 1)"
>编辑</el-button >编辑</el-button
> >
...@@ -128,19 +132,19 @@ const sceneOption = [ ...@@ -128,19 +132,19 @@ const sceneOption = [
value: '', value: '',
}, },
{ {
label: '1.0新车权益销售', label: '1.0 新车权益升级',
value: '0', value: '0',
}, },
{ {
label: '1.1次新车精品升级', label: '1.1 新车精品升级',
value: '1', value: '1',
}, },
{ {
label: '1.2次新车线上转化', label: '1.2 次新车膨胀金活动',
value: '2', value: '2',
}, },
{ {
label: '1.3存量用户众筹', label: '1.3 售后直播众筹活动',
value: '3', value: '3',
}, },
] ]
......
<template> <template>
<div style='margin: 16px'> <div style="margin: 16px">
<el-form <el-form
size='small' size="small"
inline inline
ref='withdrawalForm' ref="withdrawalForm"
:model='withdrawalSearchForm' :model="withdrawalSearchForm"
label-width='100px' label-width="100px"
class='demo-form-inline' class="demo-form-inline"
> >
<el-form-item label='员工名称'> <el-form-item label="员工名称">
<el-input <el-input
clearable clearable
v-model='withdrawalSearchForm.staffName' v-model="withdrawalSearchForm.staffName"
placeholder='请输入员工名称' placeholder="请输入员工名称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label='员工手机号'> <el-form-item label="员工手机号">
<el-input <el-input
clearable clearable
v-model='withdrawalSearchForm.staffPhone' v-model="withdrawalSearchForm.staffPhone"
placeholder='请输入员工手机号' placeholder="请输入员工手机号"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label='状态'> <el-form-item label="门店名称">
<el-select v-model='withdrawalSearchForm.status' placeholder='请选择状态'> <el-input
<el-option label='全部' value=''></el-option> clearable
<el-option label='待审核' value='1'></el-option> v-model="withdrawalSearchForm.merchantName"
<el-option label='到账中' value='2'></el-option> placeholder="请输入门店名称"
<el-option label='已到账' value='3'></el-option> ></el-input>
<el-option label='到账失败' value='4'></el-option> </el-form-item>
<el-form-item label="状态">
<el-select
v-model="withdrawalSearchForm.status"
placeholder="请选择状态"
>
<el-option label="全部" value=""></el-option>
<el-option label="待审核" value="1"></el-option>
<el-option label="到账中" value="2"></el-option>
<el-option label="已到账" value="3"></el-option>
<el-option label="到账失败" value="4"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label='提现时间'> <el-form-item label="提现时间">
<el-date-picker <el-date-picker
value-format='yyyy-MM-dd' value-format="yyyy-MM-dd"
v-model='withdrawalSearchForm.withdrawalTime' v-model="withdrawalSearchForm.withdrawalTime"
type='daterange' type="daterange"
range-separator='至' range-separator="至"
start-placeholder='开始日期' start-placeholder="开始日期"
end-placeholder='结束日期'> end-placeholder="结束日期"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label='审核时间'> <el-form-item label="审核时间">
<el-date-picker <el-date-picker
value-format='yyyy-MM-dd' value-format="yyyy-MM-dd"
v-model='withdrawalSearchForm.reviewTime' v-model="withdrawalSearchForm.reviewTime"
type='daterange' type="daterange"
range-separator='至' range-separator="至"
start-placeholder='开始日期' start-placeholder="开始日期"
end-placeholder='结束日期'> end-placeholder="结束日期"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type='primary' <el-button type="primary" @click="handleSearch">查询 </el-button>
@click='handleSearch' <el-button @click="reset">重置</el-button>
>查询
</el-button
>
<el-button @click='reset'>重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -72,12 +80,15 @@ export default { ...@@ -72,12 +80,15 @@ export default {
data() { data() {
return { return {
withdrawalSearchForm: { withdrawalSearchForm: {
status:'' status: '',
} },
} }
}, },
created() { created() {
this.$set(this.withdrawalSearchForm, 'withdrawalTime', [this.defalutStartTime, this.defalutEndTime]) this.$set(this.withdrawalSearchForm, 'withdrawalTime', [
this.defalutStartTime,
this.defalutEndTime,
])
}, },
mounted() { mounted() {
this.handleSearch() this.handleSearch()
...@@ -90,15 +101,16 @@ export default { ...@@ -90,15 +101,16 @@ export default {
Object.keys(this.withdrawalSearchForm).forEach((key) => { Object.keys(this.withdrawalSearchForm).forEach((key) => {
this.withdrawalSearchForm[key] = '' this.withdrawalSearchForm[key] = ''
}) })
this.$set(this.withdrawalSearchForm, 'withdrawalTime', [this.defalutStartTime, this.defalutEndTime]) this.$set(this.withdrawalSearchForm, 'withdrawalTime', [
this.defalutStartTime,
this.defalutEndTime,
])
this.$nextTick(() => { this.$nextTick(() => {
this.handleSearch() this.handleSearch()
}) })
} },
} },
} }
</script> </script>
<style scoped> <style scoped></style>
</style>
<template> <template>
<d2-table <d2-table
class='my-row-height' class="my-row-height"
ref='withdrawalTable' ref="withdrawalTable"
:hasNum='true' :hasNum="true"
:tableParams='withdrawalTableParams' :tableParams="withdrawalTableParams"
:searchForm='searchForm' :searchForm="searchForm"
:getListApi='getListApi' :getListApi="getListApi"
:pageConf='pageConf' :pageConf="pageConf"
@sendAlldata = 'getAmountCollection' @sendAlldata="getAmountCollection"
> >
<div slot="status" slot-scope="scope"> <div slot="status" slot-scope="scope">
<span v-if="scope.scope.status == '1'">待审核</span> <span v-if="scope.scope.status == '1'">待审核</span>
...@@ -22,18 +22,18 @@ ...@@ -22,18 +22,18 @@
import { withdrawalApi } from '@/api/withdrawalManagement' import { withdrawalApi } from '@/api/withdrawalManagement'
export default { export default {
name: 'WithdrawalTable', name: 'WithdrawalTable',
props:{ props: {
searchForm:{ searchForm: {
type:Object, type: Object,
default:{} default: {},
} },
}, },
data() { data() {
return { return {
pageConf: { pageConf: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageNum: 'pageNum', pageNum: 'pageNum',
totalCount: 'data.count' totalCount: 'data.count',
}, },
withdrawalTableParams: { withdrawalTableParams: {
mutiSelectUniqueKey: 'id', mutiSelectUniqueKey: 'id',
...@@ -42,66 +42,82 @@ export default { ...@@ -42,66 +42,82 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: '员工名称', label: '员工名称',
prop: 'staffName' prop: 'staffName',
}, },
{ {
label: '员工手机号', label: '员工手机号',
prop: 'staffPhone' prop: 'staffPhone',
},
{
label: '门店名称',
prop: 'merchantName',
}, },
{ {
label: '积分值', label: '积分值',
prop: 'withdrawalScore' prop: 'withdrawalScore',
}, },
{ {
label: '提现金额(元)', label: '提现金额(元)',
prop: 'withdrawalAmount' prop: 'withdrawalAmount',
}, },
{ {
label: '提现时间', label: '提现时间',
prop: 'withdrawalTime' prop: 'withdrawalTime',
}, },
{ {
label: '微信昵称', label: '微信昵称',
prop: 'wechatNickName' prop: 'wechatNickName',
}, },
{ {
label: '微信手机号', label: '微信手机号',
prop: 'wechatPhone' prop: 'wechatPhone',
}, },
{ {
label: '微信openid', label: '微信openid',
prop: 'wechatOpenId' prop: 'wechatOpenId',
}, },
{ {
label: '状态', label: '状态',
prop: 'status', prop: 'status',
addHtml:'status' addHtml: 'status',
}, },
{ {
label: '审核人', label: '审核人',
prop: 'reviewer' prop: 'reviewer',
}, },
{ {
label: '审核时间', label: '审核时间',
prop: 'reviewTime' prop: 'reviewTime',
}, },
{ {
label: '到账时间', label: '到账时间',
prop: 'successTime' prop: 'successTime',
} },
] ],
}, },
getListApi: withdrawalApi.withdrawalListApi, getListApi: withdrawalApi.withdrawalListApi,
} }
}, },
methods:{ methods: {
getAmountCollection(val){ getAmountCollection(val) {
let {receivedAmount,receivingAmount,reviewingAmount,totalAmount,failureAmount} =val let {
let amountCollection = {receivedAmount,receivingAmount,reviewingAmount,totalAmount,failureAmount} receivedAmount,
this.$emit('sendCollection',amountCollection) receivingAmount,
} reviewingAmount,
} totalAmount,
failureAmount,
} = val
let amountCollection = {
receivedAmount,
receivingAmount,
reviewingAmount,
totalAmount,
failureAmount,
} }
this.$emit('sendCollection', amountCollection)
},
},
}
</script> </script>
<style scoped> <style scoped>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!