Commit 3cf98bd1 by 匡雅琴

Merge branch 'kyq_dev' into 'v2.12.0'

Kyq dev

See merge request !15
2 parents 6865d575 f978f3c0
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
"node-sass": "4.14.1", "node-sass": "4.14.1",
"sass-loader": "7.3.1", "sass-loader": "7.3.1",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"md5": "^2.3.0",
"vue": "^2.6.11" "vue": "^2.6.11"
}, },
"devDependencies": { "devDependencies": {
......
import request from './request'
import Vue from 'vue'
const commonApi = {
uploadImgApi(data) {
data.method = 'glsx.accounts.biz.common.pictureUpload'
return request(
data,
'glsx.accounts.biz.common.pictureUpload',
['file'],
Vue.prototype.fileUploadURL,
true
)
},
}
export { commonApi }
...@@ -3,22 +3,33 @@ import axios from 'axios' ...@@ -3,22 +3,33 @@ import axios from 'axios'
import qs from 'qs' import qs from 'qs'
// import GlsxVueCommon from 'glsx-vue-common' // import GlsxVueCommon from 'glsx-vue-common'
import sign from './sign' import sign from './sign'
import { import { GlAxios } from 'glsx-vue-common'
GlAxios const request = (
} from 'glsx-vue-common' params = {},
const request = (params = {}, method = RequestMethods.GET, noSignAttr = [], url = '') => { method = RequestMethods.GET,
noSignAttr = [],
url = '',
isMd5 = false
) => {
params.source = 'glsx-oss-withdrawal-data' params.source = 'glsx-oss-withdrawal-data'
params.appKey = '48e5e13229b82c1b4e6e8c96151f0637' params.appKey = '48e5e13229b82c1b4e6e8c96151f0637'
params.timestamp = new Date().getTime() params.timestamp = new Date().getTime()
params.v = '1.0.0' params.v = '1.0.0'
params.format = 'json' params.format = 'json'
// params.createBy = this.$get_session_config().user.id // params.createBy = this.$get_session_config().user.id
var data = sign(params, noSignAttr) if (isMd5) {
params.app_key = params.appKey
delete params.appKey
// return axios.post(`${url}/router?method=${method}`, qs.stringify(data))
}
var data = isMd5 ? sign(params, noSignAttr, true) : sign(params, noSignAttr)
if (url) { if (url) {
return axios.post(`${url}/router?method=${method}`, qs.stringify(data)) return axios.post(`${url}/router?method=${method}`, qs.stringify(data))
} }
return method === RequestMethods.GET ? GlAxios.get('router', { return method === RequestMethods.GET
params: sign(params, noSignAttr) ? GlAxios.get('router', {
}) : GlAxios.post('router', data) params: sign(params, noSignAttr),
})
: GlAxios.post('router', data)
} }
export default request export default request
import sha1 from 'sha1' import sha1 from 'sha1'
import md5 from 'md5'
import qs from 'qs' import qs from 'qs'
import _ from 'lodash' import _ from 'lodash'
const secret = window.location.href.includes('dj.glsx.com.cn') ? '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353' : 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b' const secret = window.location.href.includes('dj.glsx.com.cn')
const sign = (params, noSignAttr = []) => { ? '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const sign = (params, noSignAttr = [], isMd5) => {
delete params.sign delete params.sign
var objStr = qs.stringify(_.cloneDeep(params), { var objStr = qs.stringify(_.cloneDeep(params), {
arrayFormat: 'indices', arrayFormat: 'indices',
allowDots: true, allowDots: true,
encodeValuesOnly: true encodeValuesOnly: true,
}) })
var objVal = objStr.split('&') var objVal = objStr.split('&')
var realObj = {} var realObj = {}
objVal.forEach(item => { objVal.forEach((item) => {
const idx = item.indexOf('=') const idx = item.indexOf('=')
realObj[item.split('=')[0]] = decodeURIComponent(item.slice(idx + 1)) realObj[item.split('=')[0]] = decodeURIComponent(item.slice(idx + 1))
}) })
...@@ -27,10 +30,12 @@ const sign = (params, noSignAttr = []) => { ...@@ -27,10 +30,12 @@ const sign = (params, noSignAttr = []) => {
} }
realObj[key] = obj realObj[key] = obj
} }
keys.forEach(e => { keys.forEach((e) => {
!noSignAttr.includes(e) && str.push(e + realObj[e]) !noSignAttr.includes(e) && str.push(e + realObj[e])
}) })
realObj.sign = sha1(secret + str.join('') + secret).toUpperCase() realObj.sign = isMd5
? md5(secret + str.join('') + secret).toUpperCase()
: sha1(secret + str.join('') + secret).toUpperCase()
return realObj return realObj
} }
export default sign export default sign
// import request from './request' import request from './request'
import Vue from 'vue'
// const path = 'scrm.api.renewal.insurance.customer.name.list.' // const path = 'scrm.api.renewal.insurance.customer.name.list.'
// const defaultPath = 'scrm.api.renewal.order.' // const defaultPath = 'scrm.api.renewal.order.'
// 获取任务列表详情
const taskApi = { const taskApi = {
// searchCustomerList(data = {}) { // 获取活动列表
// data.method = `${path}get` findMissionList(data) {
// return request(data) data.method = 'merchants.api.mission.findMissionList'
// }, return request(data)
},
// 任务状态更新
updateStatusMission(data) {
data.method = 'merchants.api.mission.updateStatusMission'
return request(data)
},
// 通过业务场景获取商户
findMerchantByScene(data) {
data.method = 'scrm.api.busassistant.merchant.byscene'
return request(
data,
'scrm.api.busassistant.merchant.byscene',
[],
Vue.prototype.businessURL
)
},
// 获取所有未结束活动
getActivityBypage(data) {
data.method = 'scrm.api.assistant.crowd.activity.page'
return request(
data,
'scrm.api.assistant.crowd.activity.page',
[],
Vue.prototype.otherUrl
)
},
// 新建任务
creatMission(data) {
data.method = 'merchants.api.mission.createMission'
return request(data, 'post')
},
// 获取任务详情
findMissionDeail(data) {
data.method = 'merchants.api.mission.findMissionDeail'
return request(data, 'post')
},
// 编辑任务
updateMission(data) {
data.method = 'merchants.api.mission.updateMission'
return request(data, 'post')
},
} }
export { taskApi } export { taskApi }
<template> <template>
<div class="ly-emotion"> <div class="ly-emotion">
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
<script> <script>
import emoji from '../../utils/emo' import emoji from '../../utils/emo'
export default { export default {
name: 'ly-emotion', name: 'ly-emotion',
...@@ -20,10 +20,10 @@ export default { ...@@ -20,10 +20,10 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$el.innerHTML = imgHTML this.$el.innerHTML = imgHTML
}) })
} },
} }
</script> </script>
<style scoped> <style scoped>
.ly-emotion { .ly-emotion {
display: inline-block; display: inline-block;
} }
......
<template> <template>
<div class="w-textarea" ref="wTextarea" v-bind="$attr"> <div class="w-textarea" ref="wTextarea">
<div contenteditable="true" class="w-textarea_input" ref="wTextareaContent" :id="contentId" @keydown="textareaKeydown($event)" @click="inputClick($event)" @focus="onFocus" @blur="onBlur" @keydown.delete="handleDelete($event)" @input="handleInput($event.target)"></div> <div
</div> contenteditable="true"
</template> class="w-textarea_input"
<script> ref="wTextareaContent"
:id="contentId"
@keydown="textareaKeydown($event)"
@click="inputClick($event)"
@focus="onFocus"
@blur="onBlur"
@keydown.delete="handleDelete($event)"
@input="handleInput($event.target)"
></div>
</div>
</template>
<script>
import emoji from '../../utils/emo' import emoji from '../../utils/emo'
export default { export default {
name: 'wTextarea', name: 'wTextarea',
...@@ -19,20 +30,20 @@ export default { ...@@ -19,20 +30,20 @@ export default {
// 记录当前选中tag的ID // 记录当前选中tag的ID
currentTagId: null, currentTagId: null,
// 当前光标位置 // 当前光标位置
savedRange: {} savedRange: {},
} }
}, },
props: { props: {
value: { value: {
type: String, type: String,
default: '' default: '',
}, },
tag: { tag: {
// 自定义模版标签的标签名 // 自定义模版标签的标签名
type: String, type: String,
// 默认使用wise作为标签名,并添加了默认样式 // 默认使用wise作为标签名,并添加了默认样式
// 当使用其他标签名的时候,需要另写标签样式 // 当使用其他标签名的时候,需要另写标签样式
default: 'wise' default: 'wise',
}, },
tools: { tools: {
// 自定义扩展功能:超链接'link',模版标签'tag' // 自定义扩展功能:超链接'link',模版标签'tag'
...@@ -40,15 +51,15 @@ export default { ...@@ -40,15 +51,15 @@ export default {
default() { default() {
return [ return [
{ type: 'link', text: '添加超链接' }, { type: 'link', text: '添加超链接' },
{ type: 'tag', text: '添加模版标签' } { type: 'tag', text: '添加模版标签' },
] ]
} },
}, },
maxlength: { maxlength: {
// 最大输入长度 // 最大输入长度
type: [String, Number], type: [String, Number],
default: '' default: '',
} },
}, },
computed: { computed: {
count() { count() {
...@@ -57,7 +68,7 @@ export default { ...@@ -57,7 +68,7 @@ export default {
let text = let text =
num < 0 ? `已超出${Math.abs(num)}个字符` : `还可以输入${num}个字符` num < 0 ? `已超出${Math.abs(num)}个字符` : `还可以输入${num}个字符`
return { num, text } return { num, text }
} },
}, },
mounted() { mounted() {
// 初始化数据 // 初始化数据
...@@ -199,7 +210,7 @@ export default { ...@@ -199,7 +210,7 @@ export default {
) )
.replace(/<wise.+?>(.+?)(?:<\/wise>)/g, '$1') .replace(/<wise.+?>(.+?)(?:<\/wise>)/g, '$1')
.replace(/<br>/g, '\n') .replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function(str) { const replaceImg = cutImg.replace(/(\d){3}.png">/g, function (str) {
let s = list[parseInt(str.split('.')[0]) - 1] let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]` return `[${s}]`
}) })
...@@ -296,7 +307,7 @@ export default { ...@@ -296,7 +307,7 @@ export default {
) { ) {
this.savedRange = range this.savedRange = range
} }
} },
}, },
watch: { watch: {
value(val) { value(val) {
...@@ -304,11 +315,11 @@ export default { ...@@ -304,11 +315,11 @@ export default {
if (!this.isLocked) { if (!this.isLocked) {
this.$refs.wTextareaContent.innerHTML = val this.$refs.wTextareaContent.innerHTML = val
} }
} },
} },
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.w-textarea { .w-textarea {
wise { wise {
user-select: none; user-select: none;
...@@ -338,7 +349,7 @@ export default { ...@@ -338,7 +349,7 @@ export default {
} }
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
$borderColor: #e5e5e5; $borderColor: #e5e5e5;
$bgColor: #f5f7fa; $bgColor: #f5f7fa;
$textColor: #666; $textColor: #666;
......
import App from './index.vue' import App from './index.vue'
import base from '@/base' import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common' import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => { import Vue from 'vue'
base.getConfig().then((data) => {
const { vue, config } = data const { vue, config } = data
Vue.prototype.otherUrl = config.axios.otherURL
Vue.prototype.fileUploadURL = config.axios.fileUploadURL
Vue.prototype.businessURL = config.axios.businessURL
vue.use(GlsxVueCommon, config) vue.use(GlsxVueCommon, config)
base.render(App) base.render(App)
}) })
<template>
<div>
<el-dialog
title="选择活动"
:visible.sync="activityDiaVisible"
width="1098px"
:before-close="handleClose"
>
<div class="activity-box">
<span>系统中已存在活动不可选择;</span>
<span v-if="isClone">复制功能,活动天数不一致的活动不可选择</span>
<div class="model-item-panel" v-if="activityData.length">
<div
class="model-item"
:class="{
checked: selectItem == item && item.taskStatus != 1,
abandon: item.taskStatus == 1,
}"
v-for="(item, index) in activityData"
:key="index"
@click="!item.taskStatus && handleSelectItem(item)"
>
<img class="model-item-img" :src="item.activityImg" alt="" />
<div class="model-item-title" :title="item.activityName">
{{ item.activityName }}
</div>
<div class="model-item-content">
开始时间:
{{ item.startTime }}
</div>
<div class="model-item-content">
结束时间:
{{ item.endTime }}
</div>
</div>
</div>
<div v-else v-loading="loading">
<div>暂无数据</div>
</div>
</div>
<div v-if="activityData.length">
<el-pagination
background
layout="sizes, total, prev, pager, next, jumper"
:page-sizes="[12, 24, 48]"
:page-size="pageParam.pageSize"
:total="pageParam.total"
:current-page="pageParam.currentPage"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="activityDiaVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmActivity">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import { taskApi } from '../../../../api/task'
export default {
name: 'activityDia',
data() {
return {
activityDiaVisible: false,
loading: false,
isClone: false,
taskDateNum: 0,
activityData: [],
selectItem: {},
pageParam: {
currentPage: 1,
pageSize: 12,
total: 0,
},
}
},
methods: {
init(merchantId, isClone, taskDateNum) {
this.activityDiaVisible = true
this.isClone = isClone
this.taskDateNum = taskDateNum
this.getActivityData(merchantId)
},
getActivityData(merchantId) {
let params = {
currentPage: 1,
pageSize: 12,
merchantId: merchantId,
activityStatuList: [1, 2],
}
taskApi.getActivityBypage(params).then((res) => {
this.activityData = res.data.data.list
this.pageParam.total = res.data.data.total
// 活动时间戳转化
this.activityData.map((item) => {
item.startTime = dayjs(item.startTime).format('YYYY-MM-DD')
item.endTime = dayjs(item.endTime).format('YYYY-MM-DD')
if (this.isClone) {
console.log(this.taskDateNum)
let activityDays = this.getDateByDays(item.startTime, item.endTime)
if (activityDays != this.taskDateNum) {
item.taskStatus = 1
}
}
})
console.log(this.activityData, 'this.activityData')
})
},
// 根据日期获取天数
getDateByDays(startDate, endDdate) {
let d1 = Date.parse(new Date(startDate))
let d2 = Date.parse(new Date(endDdate))
// 时间戳相减 / 天数
let day = parseInt((d2 - d1) / (1000 * 60 * 60 * 24)) + 1
return day
},
handleSelectItem(item) {
console.log(item)
this.selectItem = item
},
// 确认活动
confirmActivity() {
console.log(11)
if (!this.selectItem.id) {
this.$message({
message: '请选择活动',
type: 'warning',
})
return
}
this.$emit('selectActivity', this.selectItem)
this.handleClose()
},
// 关闭弹窗
handleClose() {
this.selectItem = {}
this.activityDiaVisible = false
},
handleSizeChange(val) {
this.pageParam.pageSize = val
this.getActivityData()
},
handleCurrentChange(val) {
this.pageParam.currentPage = val
this.getActivityData()
},
},
}
</script>
<style lang="scss" scoped>
.activity-box {
min-height: 200px;
}
.model-item-panel {
// display: grid;
// grid-template-columns: repeat(4, 25%);
// grid-row-gap: 10px;
// max-height: 38vh;
overflow: auto;
display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item {
width: 248px;
margin-right: 16px;
margin-bottom: 16px;
position: relative;
height: 190px;
background: #f9f9f9;
border-radius: 4px;
padding: 14px 16px;
box-sizing: border-box;
&.checked {
border: 2px solid #5850ff;
}
&.abandon {
cursor: not-allowed;
}
&:nth-child(4n) {
margin-right: 0px;
}
&-title {
font-size: 12px;
font-weight: 400;
color: #333333;
line-height: 25px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
&-img {
width: 100%;
height: 100px;
}
&-content {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 16px;
height: 16px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span {
color: #5850ff;
font-size: 20px;
}
}
&-contents {
line-height: 22px;
height: 22px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!