Commit 76f63f48 by zhangmeng

fix:人群筛选器bug修复

parent 2d9f222f
{
"printWidth": 800,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"semi": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine":true
}
...@@ -14,8 +14,9 @@ const createLintingRule = () => ({ ...@@ -14,8 +14,9 @@ const createLintingRule = () => ({
enforce: 'pre', enforce: 'pre',
include: [resolve('src'), resolve('test')], include: [resolve('src'), resolve('test')],
options: { options: {
formatter: require('eslint-friendly-formatter'), fix: true
emitWarning: !config.dev.showEslintErrorsInOverlay // formatter: require('eslint-friendly-formatter'),
// emitWarning: !config.dev.showEslintErrorsInOverlay
} }
}) })
......
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" href=./static/img/favicon.ico><title>GIC后台</title><link rel=stylesheet type=text/css href=static/css/iconfont.css><link rel=stylesheet type=text/css href=static/css/common.css><link href=/marketing/static/css/app.cf98acb6e587cee6b0414700732ad584.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/marketing/static/js/manifest.0a85049e489e85ac5f0a.js></script><script type=text/javascript src=/marketing/static/js/vendor.03e27360719f01598539.js></script><script type=text/javascript src=/marketing/static/js/app.fc65ed07334c0e1b3d6f.js></script></body></html> <!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" href=./static/img/favicon.ico><title>GIC后台</title><link rel=stylesheet type=text/css href=static/css/iconfont.css><link rel=stylesheet type=text/css href=static/css/common.css><link href=/marketing/static/css/app.0155652bb3a4c6438b6a40c3df916e1b.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/marketing/static/js/manifest.0a85049e489e85ac5f0a.js></script><script type=text/javascript src=/marketing/static/js/vendor.8c5bbe952d737561ef76.js></script><script type=text/javascript src=/marketing/static/js/app.bb02d4b901efae63ce2e.js></script></body></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -8,11 +8,23 @@ ...@@ -8,11 +8,23 @@
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev", "start": "npm run dev",
"build": "node build/build.js", "build": "node build/build.js",
"format": "onchange 'test/**/*.js' 'src/**/*.js' 'src/**/*.vue' -- prettier --write {{changed}}",
"publish": "publish.bat" "publish": "publish.bat"
}, },
"dependencies": { "dependencies": {
"@antv/data-set": "^0.8.9", "@antv/data-set": "^0.8.9",
"@antv/g2": "^3.2.6", "@antv/g2": "^3.2.6",
"@gic-test/vue-gic-card": "^1.1.1",
"@gic-test/vue-gic-confirm-people": "^1.0.6",
"@gic-test/vue-gic-footer": "^1.0.10",
"@gic-test/vue-gic-header": "^1.3.37",
"@gic-test/vue-gic-img-preview": "^1.0.13",
"@gic-test/vue-gic-member-group": "^1.0.36",
"@gic-test/vue-gic-people": "^1.8.2",
"@gic-test/vue-gic-store": "^1.1.1",
"@gic-test/vue-gic-store-group": "^1.0.5",
"@gic-test/vue-gic-store-linkage": "^1.0.7",
"@gic-test/vue-gic-store-new": "^1.2.9",
"@riophae/vue-treeselect": "^0.0.36", "@riophae/vue-treeselect": "^0.0.36",
"@tinymce/tinymce-vue": "^1.0.8", "@tinymce/tinymce-vue": "^1.0.8",
"axios": "^0.18.0", "axios": "^0.18.0",
...@@ -56,8 +68,10 @@ ...@@ -56,8 +68,10 @@
"eslint-config-standard": "^12.0.0", "eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1", "eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.1.1", "eslint-loader": "^2.1.1",
"eslint-plugin-html": "^5.0.0",
"eslint-plugin-import": "^2.14.0", "eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^7.0.1", "eslint-plugin-node": "^7.0.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.0.1", "eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0", "eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^4.7.1", "eslint-plugin-vue": "^4.7.1",
...@@ -68,6 +82,7 @@ ...@@ -68,6 +82,7 @@
"localforage": "^1.7.2", "localforage": "^1.7.2",
"node-notifier": "^5.1.2", "node-notifier": "^5.1.2",
"node-sass": "^4.9.0", "node-sass": "^4.9.0",
"onchange": "^5.2.0",
"optimize-css-assets-webpack-plugin": "^3.2.0", "optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0", "ora": "^1.2.0",
"portfinder": "^1.0.13", "portfinder": "^1.0.13",
......
<template> <template>
<div id="app"> <div id="app">
<keep-alive :include="include"> <keep-alive :include="include">
...@@ -10,19 +9,19 @@ ...@@ -10,19 +9,19 @@
<script> <script>
export default { export default {
name: 'App', name: 'App',
data(){ data() {
return { return {
include:[] include: []
} };
} }
} };
</script> </script>
<style lang="scss"> <style lang="scss">
@import './assets/theme/index.css'; @import './assets/theme/index.css';
@import './assets/style/base/index.scss'; @import './assets/style/base/index.scss';
@import './assets/iconfont/iconfont.css'; @import './assets/iconfont/iconfont.css';
#app{ #app {
height: 100%; height: 100%;
background-color: #f0f2f5; background-color: #f0f2f5;
} }
......
...@@ -37,6 +37,16 @@ ...@@ -37,6 +37,16 @@
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
margin: 0 0 20px -32px; margin: 0 0 20px -32px;
&--tips {
padding:8px 16px;
border:1px solid #91d5ff;
background: #e6f7ff;
border-radius: 4px;
color: #606266;
font-size: 13px;
margin-top: 10px;
margin-right: 32px;
}
} }
.dm-title__label--outer { .dm-title__label--outer {
......
...@@ -91,6 +91,9 @@ a:hover { ...@@ -91,6 +91,9 @@ a:hover {
.pr7{ .pr7{
padding-right: 7px!important; padding-right: 7px!important;
} }
.pr8 {
padding-right: 8px!important;
}
.pr10{ .pr10{
padding-right: 10px!important; padding-right: 10px!important;
} }
...@@ -208,7 +211,7 @@ a:hover { ...@@ -208,7 +211,7 @@ a:hover {
.blue{ .blue{
color:$primary-color; color:$primary-color;
cursor: pointer; // cursor: pointer;
} }
.gray { .gray {
color: #909399; color: #909399;
......
import vueGicAsideMenu from './component.vue' // 导入组件 import vueGicAsideMenu from './component.vue'; // 导入组件
const vueGicAside = { const vueGicAside = {
install(Vue, options) { install(Vue, options) {
Vue.component(vueGicAsideMenu.name, vueGicAsideMenu) // vueGicAsideMenu.name 组件的name属性 Vue.component(vueGicAsideMenu.name, vueGicAsideMenu); // vueGicAsideMenu.name 组件的name属性
// 类似通过 this.$xxx 方式调用插件的 其实只是挂载到原型上而已 // 类似通过 this.$xxx 方式调用插件的 其实只是挂载到原型上而已
// Vue.prototype.$xxx // 最终可以在任何地方通过 this.$xxx 调用 // Vue.prototype.$xxx // 最终可以在任何地方通过 this.$xxx 调用
// 虽然没有明确规定用$开头 但是大家都默认遵守这个规定 // 虽然没有明确规定用$开头 但是大家都默认遵守这个规定
} }
} };
if (typeof window !== 'undefined' && window.Vue) { if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(vueGicAside); window.Vue.use(vueGicAside);
} }
export default vueGicAside export default vueGicAside;
// export { // export {
// vueGicAsideMenu // vueGicAsideMenu
// } // }
<template> <template>
<el-dialog title="修改数量" :visible.sync="show" width="30%" :before-close="close" append-to-body> <el-dialog title="修改数量" :visible.sync="show" width="30%" :before-close="close" append-to-body>
奖品数量 <el-radio v-model="calculate" :label="true">增加</el-radio> 奖品数量 <el-radio v-model="calculate" :label="true">增加</el-radio>
<el-radio v-model="calculate" :label="false">减少</el-radio> <el-radio v-model="calculate" :label="false">减少</el-radio>
<div class="text-center pt10"> <div class="text-center pt10">
<el-input-number controls-position="right" :min="0" v-model="count" class="w200 block-center" @blur="checkCalc"></el-input-number> <el-input-number controls-position="right" :min="0" v-model="count" class="w200 block-center" @blur="checkCalc"></el-input-number>
<span class="fz14 pl20">结果:</span> <span class="fz14 pl20">结果:</span>
<span>{{calculate?parseInt(totalCount)+parseInt(count):parseInt(totalCount)-parseInt(count)}}</span> <span>{{ calculate ? parseInt(totalCount) + parseInt(count) : parseInt(totalCount) - parseInt(count) }}</span>
</div> </div>
<div class="text-center pt10"> <div class="text-center pt10"></div>
<span slot="footer" class="dialog-footer">
</div> <el-button @click="close">取 消</el-button>
<span slot="footer" class="dialog-footer"> <el-button type="primary" @click="submit">确 定</el-button>
<el-button @click="close">取 消</el-button> </span>
<el-button type="primary" @click="submit">确 定</el-button> </el-dialog>
</span>
</el-dialog>
</template> </template>
<script> <script>
import {updatePrizeStock} from '@/service/api/gameApi.js'; import { updatePrizeStock } from '@/service/api/gameApi.js';
export default { export default {
props:{ props: {
totalCount:{ totalCount: {
type:Number, type: Number,
default:0 default: 0
},
show:{
type:Boolean,
default:false
}, },
prizeReferType:{ show: {
type:Number, type: Boolean,
default:0 default: false
}, },
prizeId:{ prizeReferType: {
type:String, type: Number,
default:'' default: 0
}, },
prizeReferId:{ prizeId: {
type:String, type: String,
default:'' default: ''
}, },
useStrategy:{ prizeReferId: {
type:Number, type: String,
default:1 default: ''
}, },
}, useStrategy: {
data(){ type: Number,
return{ default: 1
count:0,
calculate:true
} }
}, },
methods:{ data() {
checkCalc(){ return {
count: 0,
calculate: true
};
},
methods: {
checkCalc() {
if (!this.calculate) { if (!this.calculate) {
if (this.count>this.totalCount) { if (this.count > this.totalCount) {
this.count = this.totalCount; this.count = this.totalCount;
this.$tips({type:'warning',message:'输入数量不能大于总数'}) this.$tips({ type: 'warning', message: '输入数量不能大于总数' });
} }
} }
}, },
close(){ close() {
this.$emit('update:show',false) this.$emit('update:show', false);
// this.count = 0; // this.count = 0;
}, },
submit(){ submit() {
if (!this.calculate) { if (!this.calculate) {
if (this.count>this.totalCount) { if (this.count > this.totalCount) {
this.count = this.totalCount; this.count = this.totalCount;
this.$tips({type:'warning',message:'输入数量不能大于总数'}) this.$tips({ type: 'warning', message: '输入数量不能大于总数' });
return; return;
} }
} }
let params = { let params = {
optType:this.calculate?1:2, //是 int 1: 增加; 2: 减少 optType: this.calculate ? 1 : 2, //是 int 1: 增加; 2: 减少
addCount:this.count, //是 int 增加或者减少数量 addCount: this.count, //是 int 增加或者减少数量
prizeReferType:this.prizeReferType, // 是 int 奖品类型: 积分: 1; 卡券: 2; 礼品: 3 prizeReferType: this.prizeReferType, // 是 int 奖品类型: 积分: 1; 卡券: 2; 礼品: 3
useStrategy:this.useStrategy,//是 int 首奖特殊策略: 1; 奖项设置: 0 useStrategy: this.useStrategy, //是 int 首奖特殊策略: 1; 奖项设置: 0
prizeReferId:this.prizeReferType===1?null:this.prizeReferId, //是 string 卡券, 礼品都存在, 积分传null prizeReferId: this.prizeReferType === 1 ? null : this.prizeReferId, //是 string 卡券, 礼品都存在, 积分传null
prizeId:this.prizeId, prizeId: this.prizeId
} };
updatePrizeStock(params).then(res => { updatePrizeStock(params).then(res => {
this.$emit('countRefresh',{calc:this.calculate,num:this.count}); this.$emit('countRefresh', { calc: this.calculate, num: this.count });
}); });
this.close(); this.close();
} }
} }
} };
</script> </script>
<template> <template>
<el-popover class="el-button el-button--text" <el-popover class="el-button el-button--text" placement="top" width="160" v-model="visible">
placement="top" <p style="line-height:1.5;padding:10px 10px 20px;color:#606266;">{{ tips }}</p>
width="160" <div style="text-align: right; margin: 0">
v-model="visible"> <el-button size="mini" type="text" @click="cancel">取消</el-button>
<p style="line-height:1.5;padding:10px 10px 20px;color:#606266;">{{tips}}</p> <el-button type="primary" size="mini" @click="confirm">确定</el-button>
<div style="text-align: right; margin: 0"> </div>
<el-button size="mini" type="text" @click="cancel">取消</el-button> <span slot="reference"><slot></slot></span>
<el-button type="primary" size="mini" @click="confirm">确定</el-button> </el-popover>
</div>
<span slot="reference"><slot></slot></span>
</el-popover>
</template> </template>
<script> <script>
export default { export default {
name:'dm-delete', name: 'dm-delete',
props:{ props: {
tips:{ tips: {
type:String, type: String,
default:'是否删除?' default: '是否删除?'
}, }
}, },
data() { data() {
return { return {
visible: false, visible: false
}; };
},
methods: {
cancel() {
this.visible = false;
}, },
methods:{ confirm() {
cancel() { this.visible = false;
this.visible = false this.$emit('confirm');
},
confirm() {
this.visible = false
this.$emit('confirm')
}
} }
} }
};
</script> </script>
<template> <template>
<el-option :value="value" :label="label" :disabled="disabled"> <el-option :value="value" :label="label" :disabled="disabled">
<span style="float: left">{{ item.value }}</span> <span style="float: left">{{ item.value }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.label }}</span> <span style="float: right; color: #8492a6; font-size: 13px">{{ item.label }}</span>
</el-option> </el-option>
</template> </template>
<script> <script>
export default { export default {
props: {
props: { value: {
value: { required: true
required: true
},
label: [String, Number],
disabled: {
type: Boolean,
default: false
}
},
computed: {
parent() {
let parent = this.$parent;
let parentName = parent.$options.componentName;
while (parentName !== 'BDSelect') {
parent = parent.$parent;
parentName = parent.$options.componentName;
}
return parent;
}
}, },
label: [String, Number],
created() { disabled: {
this.parent.options.push({ label: this.label, value: this.value }); type: Boolean,
default: false
}
},
computed: {
parent() {
let parent = this.$parent;
let parentName = parent.$options.componentName;
while (parentName !== 'BDSelect') {
parent = parent.$parent;
parentName = parent.$options.componentName;
}
return parent;
} }
} },
created() {
this.parent.options.push({ label: this.label, value: this.value });
}
};
</script> </script>
import {elTable} from 'element-ui'; import { elTable } from 'element-ui';
import Vue from 'vue'; import Vue from 'vue';
const CompVue = Vue.extend(elTable);
const CompVue = Vue.extend(elTable) export default new CompVue({});
export default = new CompVue({
})
import lgPreview from './preview.vue' import lgPreview from './preview.vue';
export default { export default {
install: function (Vue, options) { install: function(Vue, options) {
// 添加的内容写在这个函数里面 // 添加的内容写在这个函数里面
const LOGIC_EVENT_BUS = new Vue({ const LOGIC_EVENT_BUS = new Vue({
data(){ data() {
return { return {
LOGIC_PREVIEW : { LOGIC_PREVIEW: {
isTitleEnable: true, isTitleEnable: true,
isHorizontalNavEnable: true, isHorizontalNavEnable: true,
show: false, show: false,
loading : true, loading: true,
current: { current: {
title: '', title: '',
src: '' src: ''
}, },
list: [] list: []
} }
} };
} }
}) });
window.LOGIC_EVENT_BUS = LOGIC_EVENT_BUS window.LOGIC_EVENT_BUS = LOGIC_EVENT_BUS;
Vue.component('lg-preview', lgPreview) Vue.component('lg-preview', lgPreview);
const updateIndex = function (list) { const updateIndex = function(list) {
list.forEach(function (item, index) { list.forEach(function(item, index) {
item.index = index + 1 item.index = index + 1;
}) });
} };
function getImage (src, previewItem) { function getImage(src, previewItem) {
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
const img = new window.Image() const img = new window.Image();
img.src = src img.src = src;
img.onload = function () { img.onload = function() {
previewItem['naturalHeight'] = img.naturalHeight previewItem['naturalHeight'] = img.naturalHeight;
previewItem['naturalWidth'] = img.naturalWidth previewItem['naturalWidth'] = img.naturalWidth;
setTimeout(function () { setTimeout(function() {
LOGIC_EVENT_BUS.LOGIC_PREVIEW.loading = false LOGIC_EVENT_BUS.LOGIC_PREVIEW.loading = false;
},500) }, 500);
resolve(img) resolve(img);
} };
img.error = function (e) { img.error = function(e) {
reject(e) reject(e);
} };
}) });
} }
Vue.directive('preview', { Vue.directive('preview', {
bind: function (el) { bind: function(el) {
var previewItem = { var previewItem = {
title: '', title: '',
el: el, el: el,
index: 0, index: 0,
src: '' src: ''
} };
LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.push(previewItem) LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.push(previewItem);
updateIndex(LOGIC_EVENT_BUS.LOGIC_PREVIEW.list) updateIndex(LOGIC_EVENT_BUS.LOGIC_PREVIEW.list);
el.addEventListener('click', function (e) { el.addEventListener('click', function(e) {
e.stopPropagation() e.stopPropagation();
LOGIC_EVENT_BUS.LOGIC_PREVIEW.isTitleEnable = el.getAttribute('preview-title-enable')== "false" ? false : true; LOGIC_EVENT_BUS.LOGIC_PREVIEW.isTitleEnable = el.getAttribute('preview-title-enable') == 'false' ? false : true;
LOGIC_EVENT_BUS.LOGIC_PREVIEW.isHorizontalNavEnable = el.getAttribute('preview-nav-enable')== "false" ? false : true; LOGIC_EVENT_BUS.LOGIC_PREVIEW.isHorizontalNavEnable = el.getAttribute('preview-nav-enable') == 'false' ? false : true;
LOGIC_EVENT_BUS.LOGIC_PREVIEW.show = true LOGIC_EVENT_BUS.LOGIC_PREVIEW.show = true;
LOGIC_EVENT_BUS.LOGIC_PREVIEW.loading = true LOGIC_EVENT_BUS.LOGIC_PREVIEW.loading = true;
LOGIC_EVENT_BUS.LOGIC_PREVIEW.current = previewItem LOGIC_EVENT_BUS.LOGIC_PREVIEW.current = previewItem;
getImage(previewItem.src, previewItem) getImage(previewItem.src, previewItem);
}) });
}, },
update: function (el, oldValue) { update: function(el, oldValue) {
var previewItem = LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.find(function (item) { var previewItem = LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.find(function(item) {
return item.el === el return item.el === el;
}) });
if (!previewItem) return if (!previewItem) return;
previewItem.src = oldValue.value previewItem.src = oldValue.value;
previewItem.title = el.alt previewItem.title = el.alt;
}, },
unbind: function (el) { unbind: function(el) {
if (el) { if (el) {
LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.forEach(function (item, index) { LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.forEach(function(item, index) {
if (el === item.el) { if (el === item.el) {
LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.splice(index, 1) LOGIC_EVENT_BUS.LOGIC_PREVIEW.list.splice(index, 1);
}
})
}
updateIndex(LOGIC_EVENT_BUS.LOGIC_PREVIEW.list)
} }
}) });
} }
updateIndex(LOGIC_EVENT_BUS.LOGIC_PREVIEW.list);
}
});
}
}; };
...@@ -2,4 +2,4 @@ import upload from './upload'; ...@@ -2,4 +2,4 @@ import upload from './upload';
export default { export default {
upload upload
} };
<template> <template>
<div class="layout-container" :style="{height:bodyHeight+'px'}"> <div class="layout-container" :style="{ height: bodyHeight + 'px' }">
<vue-gic-header-test class="user-header-pop" style="z-index: 1999;" :projectName="projectName" :collapseFlag="collapseFlag" @collapseTag="collapseTagHandler" @toRouterView="toRouterView"></vue-gic-header-test> <vue-gic-header-test class="user-header-pop" style="z-index: 1999;" :projectName="projectName" :collapseFlag="collapseFlag" @collapseTag="collapseTagHandler" @toRouterView="toRouterView"></vue-gic-header-test>
<div class="layout"> <div class="layout">
<vue-gic-aside-menu class="layout-left" v-if="asideShow" :projectName="projectName" :leftModulesName="leftModulesName" :collapseFlag.sync="collapseFlag"></vue-gic-aside-menu> <vue-gic-aside-menu class="layout-left" v-if="asideShow" :projectName="projectName" :leftModulesName="leftModulesName" :collapseFlag.sync="collapseFlag"></vue-gic-aside-menu>
<div class="layout-right" :class="[{'asideShow': asideShow},{'collapseFlag':asideShow && collapseFlag}]"> <div class="layout-right" :class="[{ asideShow: asideShow }, { collapseFlag: asideShow && collapseFlag }]">
<div class="layout-title"> <div class="layout-title">
<el-breadcrumb class="dm-breadcrumb" separator="/"> <el-breadcrumb class="dm-breadcrumb" separator="/">
<el-breadcrumb-item :to="{ path: '' }"><a href="/report/#/memberSummary">首页</a></el-breadcrumb-item> <el-breadcrumb-item :to="{ path: '' }"><a href="/report/#/memberSummary">首页</a></el-breadcrumb-item>
<el-breadcrumb-item :class="{'no-link':!v.path}" v-for="(v,i) in breadcrumb" :key="i" :to="{ path: v.path }">{{v.name}}</el-breadcrumb-item> <el-breadcrumb-item :class="{ 'no-link': !v.path }" v-for="(v, i) in breadcrumb" :key="i" :to="{ path: v.path }">{{ v.name }}</el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
<h3> <h3>
<span>{{contentTitle}}</span> <span>{{ contentTitle }}</span>
<div v-html="layoutTips" class="layout--tips--wrap"></div> <div v-html="layoutTips" class="layout--tips--wrap"></div>
</h3> </h3>
</div> </div>
<div class="layout-content__wrap"> <div class="layout-content__wrap">
<div class="layout-content" :class="[{'asideShow': asideShow},{'collapseFlag':asideShow && collapseFlag}]"> <div class="layout-content" :class="[{ asideShow: asideShow }, { collapseFlag: asideShow && collapseFlag }]">
<router-view></router-view> <router-view></router-view>
</div> </div>
</div> </div>
...@@ -26,173 +26,172 @@ ...@@ -26,173 +26,172 @@
</div> </div>
</template> </template>
<script> <script>
import vueGicHeader from '@gic-test/vue-gic-header/src/lib/vue-gic-header.vue' import vueGicHeader from '@gic-test/vue-gic-header/src/lib/vue-gic-header.vue';
export default { export default {
components:{ components: {
'vue-gic-header-test':vueGicHeader 'vue-gic-header-test': vueGicHeader
},
data() {
return {
collapseFlag: false,
projectName: 'marketing',
leftModulesName: '公众号配置',
bodyHeight: 0
};
},
created() {
$bus.$on('aside-menu', val => {
this.leftMenuRouter = val;
});
},
mounted() {
this.bodyHeight = document.body.clientHeight || document.documentElement.clientHeight;
},
destroyed() {
$bus.$off('aside-menu');
},
computed: {
asideShow() {
return this.$store.state.marketing.asideShow;
}, },
data () { contentTitle() {
return { return this.$route.name;
collapseFlag: false,
projectName: "marketing",
leftModulesName: '公众号配置',
bodyHeight:0
}
},
created(){
$bus.$on('aside-menu',val => {
this.leftMenuRouter = val
})
}, },
mounted(){ breadcrumb() {
this.bodyHeight = document.body.clientHeight || document.documentElement.clientHeight; return this.$store.state.marketing.breadcrumb;
}, },
destroyed() { layoutTips() {
$bus.$off('aside-menu'); return this.$store.state.marketing.layoutTips;
}
},
// watch:{
// asideShow(val) {
// this.collapseFlag = this.asideShow;
// }
// },
methods: {
// 处理路由跳转
toRouterView(val) {
var that = this;
// 模拟检查数据
// //有两个参数
//{
// name:,
// path:
//}
that.$router.push({
path: val
});
}, },
computed: { // 处理路由跳转
asideShow() { toRouterView(val) {
return this.$store.state.marketing.asideShow; //有两个参数
}, //{
contentTitle() { // name:,
return this.$route.name // path:
}, //}
breadcrumb() { this.$router.push({
return this.$store.state.marketing.breadcrumb; path: val.path
}, });
layoutTips() {
return this.$store.state.marketing.layoutTips;
}
}, },
// watch:{ // 折叠事件
// asideShow(val) { collapseTagHandler(val) {
// this.collapseFlag = this.asideShow; this.collapseFlag = val;
// }
// },
methods: {
// 处理路由跳转
toRouterView(val) {
var that = this;
// 模拟检查数据
// //有两个参数
//{
// name:,
// path:
//}
that.$router.push({
path: val
})
},
// 处理路由跳转
toRouterView(val) {
//有两个参数
//{
// name:,
// path:
//}
this.$router.push({
path: val.path
})
},
// 折叠事件
collapseTagHandler(val){
this.collapseFlag = val
}
} }
} }
};
</script> </script>
<style lang="scss"> <style lang="scss">
.layout-container{ .layout-container {
height:100%; height: 100%;
display:flex; display: flex;
}
.layout {
display: flex;
flex-direction: row;
background-color: #f0f2f5;
height: calc(100% - 64px);
overflow-x: auto;
overflow-y: hidden;
margin-top: 64px;
width: 100%;
&-left {
width: 200px;
display: inline-block;
position: fixed;
left: 0;
z-index: 9;
} }
.layout { &-right {
display: flex; position: relative;
flex-direction: row; flex: 1;
background-color: #f0f2f5;
height: calc(100% - 64px);
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; transition: width 0.5s;
margin-top: 64px; -moz-transition: width 0.5s;
width: 100%; -webkit-transition: width 0.5s;
&-left { -o-transition: width 0.5s;
width: 200px; height: 100%;
display: inline-block; // overflow-y: auto;
position: fixed; margin-left: 0px;
left: 0; min-width: 1400px;
z-index: 9; &.asideShow {
min-width: 1200px;
margin-left: 200px;
} }
&-right{ &.collapseFlag {
position: relative; min-width: 1336px;
flex: 1; margin-left: 64px;
overflow-x:auto;
transition: width 0.5s;
-moz-transition: width 0.5s;
-webkit-transition: width 0.5s;
-o-transition: width 0.5s;
height: 100%;
// overflow-y: auto;
margin-left:0px;
min-width: 1400px;
&.asideShow{
min-width: 1200px;
margin-left: 200px;
}
&.collapseFlag{
min-width: 1336px;
margin-left: 64px;
}
} }
&-title{ }
background:#fff; &-title {
padding:15px 0 0 30px; background: #fff;
border-bottom: 1px solid #e4e7ed; padding: 15px 0 0 30px;
h3 { border-bottom: 1px solid #e4e7ed;
color:#303133; h3 {
font-size:20px; color: #303133;
padding:24px 0; font-size: 20px;
font-weight:500; padding: 24px 0;
} font-weight: 500;
} }
&-content__wrap { }
// overflow-y: auto; &-content__wrap {
position: relative; // overflow-y: auto;
top:-1px; position: relative;
min-height: calc(100% - 200px); top: -1px;
&::-webkit-scrollbar { min-height: calc(100% - 200px);
display: none; &::-webkit-scrollbar {
} display: none;
} }
&--tips--wrap { }
margin-right: 24px; &--tips--wrap {
margin-right: 24px;
}
&--tips {
margin-top: 24px;
padding: 8px 16px;
line-height: 1.5;
font-size: 13px;
border-radius: 4px;
color: #606266;
background-color: #f4f4f5;
i {
margin-right: 4px;
color: #1890ff;
} }
&--tips { &__content {
margin-top: 24px; display: inline-block;
padding: 8px 16px; vertical-align: middle;
line-height: 1.5; width: calc(100% - 50px);
font-size: 13px; p {
border-radius: 4px; color: #606266;
color: #606266;
background-color: #f4f4f5;
i {
margin-right: 4px;
color: #1890ff;
}
&__content{
display: inline-block;
vertical-align: middle;
width: calc(100% - 50px);
p {
color: #606266;
}
} }
} }
} }
.dm-breadcrumb{ }
display: inline-block; .dm-breadcrumb {
vertical-align: middle; display: inline-block;
} vertical-align: middle;
}
.user-header-pop { .user-header-pop {
min-width: 95px; min-width: 95px;
...@@ -200,5 +199,4 @@ import vueGicHeader from '@gic-test/vue-gic-header/src/lib/vue-gic-header.vue' ...@@ -200,5 +199,4 @@ import vueGicHeader from '@gic-test/vue-gic-header/src/lib/vue-gic-header.vue'
.el-popover.user-header-pop { .el-popover.user-header-pop {
min-width: 95px; min-width: 95px;
} }
</style> </style>
<template> <template>
<label :name="imgData.imageId" class="dm-img-item"> <label :name="imgData.imageId" class="dm-img-item">
<div class="dm-img-item_top" @mouseover="optShow = true" @mouseout="optShow = false"> <div class="dm-img-item_top" @mouseover="optShow = true" @mouseout="optShow = false">
<img :src="imgData.qcloudImageUrl" alt="" srcset=""> <img :src="imgData.qcloudImageUrl" alt="" srcset="" />
<div class="dm-img-item_opt" v-show="optShow"> <div class="dm-img-item_opt" v-show="optShow">
<i class="fz14 el-icon-edit cursor" @click.stop.prevent="edit"></i> <i class="fz14 el-icon-edit cursor" @click.stop.prevent="edit"></i>
<i class="iconfont icon-fenzu cursor" @click.stop.prevent="move"></i> <i class="iconfont icon-fenzu cursor" @click.stop.prevent="move"></i>
<i class="fz14 el-icon-delete cursor" @click.stop.prevent="del"></i> <i class="fz14 el-icon-delete cursor" @click.stop.prevent="del"></i>
</div> </div>
</div> </div>
<div class="dm-img-item_center"> <div class="dm-img-item_center">
<el-checkbox :label="imgData.imageId">{{imgData.imageTitle}}</el-checkbox> <el-checkbox :label="imgData.imageId">{{ imgData.imageTitle }}</el-checkbox>
</div> </div>
</label> </label>
</template> </template>
<script> <script>
import {updateImgName} from '@/service/api/wechatApi.js'; import { updateImgName } from '@/service/api/wechatApi.js';
export default { export default {
props:{ props: {
imgData:{ imgData: {
type:Object, type: Object,
default:() => { default: () => {
return { return {
qcloudImageUrl:'', qcloudImageUrl: '',
imageId:'', imageId: '',
imageTitle:'' imageTitle: ''
} };
} }
} }
}, },
data() { data() {
return { return {
optShow:false optShow: false
} };
}, },
methods:{ methods: {
edit() { edit() {
this.$prompt('', '修改图片名称', { this.$prompt('', '修改图片名称', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelBUttonText: '取消', cancelBUttonText: '取消',
inputPattern: /\S/, inputPattern: /\S/,
inputPlaceholder:'请输入新名称', inputPlaceholder: '请输入新名称',
inputErrorMessage: '名称不能为空', inputErrorMessage: '名称不能为空',
inputValue:this.imgData.imageTitle, inputValue: this.imgData.imageTitle
}).then(({ value }) => { })
.then(({ value }) => {
this.updateImgName(value); this.updateImgName(value);
}).catch(() => { })
.catch(() => {
this.$tips({ this.$tips({
type: 'info', type: 'info',
message: '取消修改' message: '取消修改'
...@@ -54,24 +55,24 @@ export default { ...@@ -54,24 +55,24 @@ export default {
}); });
}, },
del(val) { del(val) {
this.$emit('delSingleImg',this.imgData.imageId); this.$emit('delSingleImg', this.imgData.imageId);
}, },
move() { move() {
this.$emit('moveSingleImg',this.imgData.imageId); this.$emit('moveSingleImg', this.imgData.imageId);
}, },
async updateImgName(val) { async updateImgName(val) {
let res = await updateImgName({imageId:this.imgData.imageId,imageTitle:val}); let res = await updateImgName({ imageId: this.imgData.imageId, imageTitle: val });
this.$tips({type: 'success',message: '修改成功'}); this.$tips({ type: 'success', message: '修改成功' });
this.$emit('refresh'); this.$emit('refresh');
} }
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../assets/style/base/var.scss'; @import '../../../assets/style/base/var.scss';
@import '../../../assets/style/mixin/index.scss'; @import '../../../assets/style/mixin/index.scss';
.dm-img-item{ .dm-img-item {
width: 168px; width: 168px;
margin: 20px 10px 0 10px; margin: 20px 10px 0 10px;
float: left; float: left;
...@@ -79,20 +80,20 @@ export default { ...@@ -79,20 +80,20 @@ export default {
border-radius: 2px; border-radius: 2px;
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
&:hover{ &:hover {
border: 1px solid #1890ff; border: 1px solid #1890ff;
} }
&_top{ &_top {
position: relative; position: relative;
width: 168px; width: 168px;
height: 168px; height: 168px;
img{ img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
&_center{ &_center {
border-top:1px solid $border-color; border-top: 1px solid $border-color;
height: 32px; height: 32px;
display: flex; display: flex;
justify-content: left; justify-content: left;
...@@ -109,29 +110,28 @@ export default { ...@@ -109,29 +110,28 @@ export default {
padding-left: 10px; padding-left: 10px;
} }
} }
&_opt{ &_opt {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
// border-top:1px solid $border-color; // border-top:1px solid $border-color;
background: rgba(0,0,0,.5); background: rgba(0, 0, 0, 0.5);
height: 32px; height: 32px;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
color: #fff; color: #fff;
i { i {
&:hover{ &:hover {
color:#1890ff; color: #1890ff;
} }
} }
.el-icon-delete{ .el-icon-delete {
&:hover{ &:hover {
color:#f56c6c; color: #f56c6c;
} }
} }
} }
} }
</style> </style>
<template> <template>
<label :name="imgData.imageMediaId" class="dm-img-item" :class="{'active':active === imgData.imageId}" @click="chooseImg"> <label :name="imgData.imageMediaId" class="dm-img-item" :class="{ active: active === imgData.imageId }" @click="chooseImg">
<div class="dm-img-item_top"> <div class="dm-img-item_top">
<img :src="imgData.qcloudImageUrl" alt="" srcset=""> <img :src="imgData.qcloudImageUrl" alt="" srcset="" />
</div> </div>
<div class="dm-img-item_center"> <div class="dm-img-item_center">
<el-checkbox :label="imgData.imageMediaId">{{imgData.imageTitle}}</el-checkbox> <el-checkbox :label="imgData.imageMediaId">{{ imgData.imageTitle }}</el-checkbox>
</div> </div>
</label> </label>
</template> </template>
<script> <script>
export default { export default {
props:{ props: {
imgData:{ imgData: {
type:Object, type: Object,
default:() => { default: () => {
return { return {
qcloudImageUrl:'', qcloudImageUrl: '',
imageId:'', imageId: '',
imageTitle:'' imageTitle: ''
} };
} }
} }
}, },
data() { data() {
return { return {
active:'' active: ''
} };
}, },
methods:{ methods: {
chooseImg() { chooseImg() {
$bus.$emit('img-temp-choose',this.imgData); $bus.$emit('img-temp-choose', this.imgData);
} }
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../assets/style/base/var.scss'; @import '../../../assets/style/base/var.scss';
@import '../../../assets/style/mixin/index.scss'; @import '../../../assets/style/mixin/index.scss';
.dm-img-item{ .dm-img-item {
width: 168px; width: 168px;
margin: 20px 10px 0 10px; margin: 20px 10px 0 10px;
float: left; float: left;
...@@ -46,33 +46,33 @@ export default { ...@@ -46,33 +46,33 @@ export default {
border-radius: 2px; border-radius: 2px;
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
&:hover{ &:hover {
border: 1px solid #1890ff; border: 1px solid #1890ff;
} }
&_top{ &_top {
width: 168px; width: 168px;
height: 168px; height: 168px;
position: relative; position: relative;
img{ img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
&_center{ &_center {
border-top:1px solid $border-color; border-top: 1px solid $border-color;
height: 32px; height: 32px;
display: flex; display: flex;
justify-content: left; justify-content: left;
align-items: center; align-items: center;
padding-left: 10px; padding-left: 10px;
/deep/ .el-checkbox__label{ /deep/ .el-checkbox__label {
@include ellipsis(130px); @include ellipsis(130px);
vertical-align: middle; vertical-align: middle;
padding-left: 10px; padding-left: 10px;
} }
} }
&_bottom{ &_bottom {
border-top:1px solid $border-color; border-top: 1px solid $border-color;
height: 32px; height: 32px;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
...@@ -80,5 +80,4 @@ export default { ...@@ -80,5 +80,4 @@ export default {
background: $gray-color; background: $gray-color;
} }
} }
</style> </style>
<template> <template>
<el-dialog title="移动图片" :visible.sync="show" width="30%" :before-close="close" v-loading="loading"> <el-dialog title="移动图片" :visible.sync="show" width="30%" :before-close="close" v-loading="loading">
<el-select v-model="radio" placeholder="请选择"> <el-select v-model="radio" placeholder="请选择">
<el-option <el-option v-for="item in dataList" :key="item.wechatImageGroupId" :label="item.groupName" :value="item.wechatImageGroupId"> </el-option>
v-for="item in dataList" </el-select>
:key="item.wechatImageGroupId" <span slot="footer" class="dialog-footer">
:label="item.groupName" <el-button type="primary" @click="submit">确 定</el-button>
:value="item.wechatImageGroupId"> <el-button @click="close">取 消</el-button>
</el-option> </span>
</el-select> </el-dialog>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit">确 定</el-button>
<el-button @click="close">取 消</el-button>
</span>
</el-dialog>
</template> </template>
<script> <script>
export default { export default {
props:{ props: {
show:{ show: {
type:Boolean, type: Boolean,
default:false default: false
},
dataList:{
type:Array,
default:[]
},
}, },
data() { dataList: {
return { type: Array,
loading:false, default: []
radio:'' }
}; },
data() {
return {
loading: false,
radio: ''
};
},
methods: {
close() {
this.$emit('update:show', false);
this.radio = '';
}, },
methods: { submit() {
close() { if (!this.radio) {
this.$emit('update:show',false); this.$tips({ type: 'warning', message: '请选择移入选择分组' });
this.radio = '' return;
},
submit() {
if (!this.radio) {
this.$tips({type:'warning',message:'请选择移入选择分组'});
return;
}
this.$emit('moveFinish',this.radio);
this.radio = ''
} }
this.$emit('moveFinish', this.radio);
this.radio = '';
} }
}; }
};
</script> </script>
<template> <template>
<section :class="{'dm-wrap':auto}"> <section :class="{ 'dm-wrap': auto }">
<div class="dm-imgtext_head" :class="pbSize"> <div class="dm-imgtext_head" :class="pbSize">
<div>图文消息(共{{total}}条) <el-input v-model="listParams.searchName" clearable class="w200 ml10" placeholder="请输入标题/作者" @change="loadImgTextList"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input></div> <div>
图文消息(共{{ total }}条) <el-input v-model="listParams.searchName" clearable class="w200 ml10" placeholder="请输入标题/作者" @change="loadImgTextList"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input>
</div>
<div> <div>
<el-button type="primary" @click="add">新建图文</el-button> <el-button type="primary" @click="add">新建图文</el-button>
<el-button v-if="auto" @click="check">检查同步</el-button> <el-button v-if="auto" @click="check">检查同步</el-button>
...@@ -9,38 +11,38 @@ ...@@ -9,38 +11,38 @@
</div> </div>
<el-radio-group class="dm-imgtext-list" v-model="selectedData" v-loading="loading" :style="scrollStyle"> <el-radio-group class="dm-imgtext-list" v-model="selectedData" v-loading="loading" :style="scrollStyle">
<el-table tooltipEffect="light" :data="textImgList" style="width: 100%" @row-click="rowClick"> <el-table tooltipEffect="light" :data="textImgList" style="width: 100%" @row-click="rowClick">
<el-table-column label="" align="center" v-if="radioShow"> <el-table-column label="" align="center" v-if="radioShow">
<template slot-scope="scope" > <template slot-scope="scope">
<div class="label-hidden"><el-radio :label="scope.row"></el-radio></div> <div class="label-hidden"><el-radio :label="scope.row"></el-radio></div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="图片" align="left"> <el-table-column label="图片" align="left">
<template slot-scope="scope" > <template slot-scope="scope">
<img width="100" height="100" :src="scope.row.itemList.length?(scope.row.itemList[0].qcloudImageUrl || ''):''" alt=""> <img width="100" height="100" :src="scope.row.itemList.length ? scope.row.itemList[0].qcloudImageUrl || '' : ''" alt="" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="图文标题" align="left"> <el-table-column label="图文标题" align="left">
<template slot-scope="scope" > <template slot-scope="scope">
<a class="blue" :href="scope.row.itemList.length?(scope.row.itemList[0].mediaUrl || ''):''" target="_blank">{{scope.row.itemList.length?(scope.row.itemList[0].titleName || ''):''}}</a> <a class="blue" :href="scope.row.itemList.length ? scope.row.itemList[0].mediaUrl || '' : ''" target="_blank">{{ scope.row.itemList.length ? scope.row.itemList[0].titleName || '' : '' }}</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="作者" prop="updateTimeStr" align="left" > <el-table-column label="作者" prop="updateTimeStr" align="left">
<template slot-scope="scope" > <template slot-scope="scope">
<p>{{scope.row.itemList.length?(scope.row.itemList[0].authorName || '--'):''}}</p> <p>{{ scope.row.itemList.length ? scope.row.itemList[0].authorName || '--' : '' }}</p>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="修改时间" prop="updateTimeStr" align="left"> <el-table-column label="修改时间" prop="updateTimeStr" align="left">
<template slot-scope="scope" > <template slot-scope="scope">
{{scope.row.updateTimeStr}} {{ scope.row.updateTimeStr }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="left" v-if="auto"> <el-table-column label="操作" align="left" v-if="auto">
<template slot-scope="scope" > <template slot-scope="scope">
<el-button type="text" @click="editData(scope.row)">编辑</el-button> <el-button type="text" @click="editData(scope.row)">编辑</el-button>
<dm-delete @confirm="delData(scope.row)" tips="确认删除该图文?"> <dm-delete @confirm="delData(scope.row)" tips="确认删除该图文?">
<el-button type="text">删除</el-button> <el-button type="text">删除</el-button>
</dm-delete> </dm-delete>
<el-button type="text" @click="$router.push('/wechat/record/add/'+scope.row.imageTextId)">使用</el-button> <el-button type="text" @click="$router.push('/wechat/record/add/' + scope.row.imageTextId)">使用</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -50,78 +52,77 @@ ...@@ -50,78 +52,77 @@
</section> </section>
</template> </template>
<script> <script>
import {loadImgTextList,deleteImageText} from '@/service/api/wechatApi.js'; import { loadImgTextList, deleteImageText } from '@/service/api/wechatApi.js';
import {formateDateTimeByType} from '@/utils/index.js' import { formateDateTimeByType } from '@/utils/index.js';
import syncImgtext from './syncImgtext'; import syncImgtext from './syncImgtext';
export default { export default {
props:{ props: {
scrollStyle:Object, scrollStyle: Object,
auto:{ auto: {
type:Boolean, type: Boolean,
default:true default: true
},
radioShow:{
type:Boolean,
default:false
}, },
activeId:String, radioShow: {
pbSize:{ type: Boolean,
type:String, default: false
default:'pb22'
}, },
activeId: String,
pbSize: {
type: String,
default: 'pb22'
}
}, },
created(){ created() {
this.loadImgTextList(); this.loadImgTextList();
}, },
data() { data() {
return { return {
textImgList:[], textImgList: [],
listParams:{ listParams: {
currentPage:1, currentPage: 1,
pageSize:20, pageSize: 20,
searchName:'' searchName: ''
}, },
total:0, total: 0,
loading:false, loading: false,
syncImgTextShow:false, syncImgTextShow: false,
selectedImgTextId:'', selectedImgTextId: '',
selectedData:{} selectedData: {}
} };
}, },
components:{ components: {
syncImgtext syncImgtext
}, },
watch:{ watch: {
activeId(val) { activeId(val) {
this.textImgList.map(v => { this.textImgList.map(v => {
if (this.activeId === v.imageTextWechatId) { if (this.activeId === v.imageTextWechatId) {
this.selectedData = v; this.selectedData = v;
} }
}) });
} }
}, },
methods:{ methods: {
async loadImgTextList() { async loadImgTextList() {
this.loading = true this.loading = true;
try { try {
let res = await loadImgTextList(this.listParams); let res = await loadImgTextList(this.listParams);
if (res.errorCode === 0) { if (res.errorCode === 0) {
this.textImgList = res.result.result || []; this.textImgList = res.result.result || [];
this.total = res.result.totalCount; this.total = res.result.totalCount;
this.textImgList.map(v => { this.textImgList.map(v => {
v.createTimeStr = formateDateTimeByType(v.createTime,'yyyy-MM-dd-HH-mm') v.createTimeStr = formateDateTimeByType(v.createTime, 'yyyy-MM-dd-HH-mm');
v.updateTimeStr = formateDateTimeByType(v.updateTime,'yyyy-MM-dd-HH-mm') v.updateTimeStr = formateDateTimeByType(v.updateTime, 'yyyy-MM-dd-HH-mm');
if (this.activeId === v.imageTextWechatId) { if (this.activeId === v.imageTextWechatId) {
this.selectedData = v; this.selectedData = v;
} }
}) });
} }
} catch(err) { } catch (err) {
this.$tips({type:'warning',message:'列表请求出错,请稍后再试'}); this.$tips({ type: 'warning', message: '列表请求出错,请稍后再试' });
} }
this.loading = false this.loading = false;
}, },
reset() { reset() {
this.listParams.searchName = ''; this.listParams.searchName = '';
...@@ -132,21 +133,23 @@ export default { ...@@ -132,21 +133,23 @@ export default {
}, },
rowClick(row) { rowClick(row) {
this.selectedData = row; this.selectedData = row;
this.$emit('get-data',{imageTextId:row.imageTextId,imageTextWechatId:row.imageTextWechatId}) this.$emit('get-data', { imageTextId: row.imageTextId, imageTextWechatId: row.imageTextWechatId });
}, },
add () { add() {
this.$router.push('/wechat/editor'); this.$router.push('/wechat/editor');
}, },
editData(row) { editData(row) {
this.$router.push('/wechat/editor/'+row.imageTextId); this.$router.push('/wechat/editor/' + row.imageTextId);
}, },
delData(row) { delData(row) {
deleteImageText({imageTextId:row.imageTextId}).then(res => { deleteImageText({ imageTextId: row.imageTextId })
this.$tips({type: 'success',message: '删除成功!'}); .then(res => {
this.$tips({ type: 'success', message: '删除成功!' });
this.loadImgTextList(); this.loadImgTextList();
}).catch(err => { })
this.$tips({type: 'error',message: '删除失败!'}); .catch(err => {
}) this.$tips({ type: 'error', message: '删除失败!' });
});
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.listParams.pageSize = val; this.listParams.pageSize = val;
...@@ -157,37 +160,36 @@ export default { ...@@ -157,37 +160,36 @@ export default {
this.loadImgTextList(); this.loadImgTextList();
} }
} }
};
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dm-imgtext_head{ .dm-imgtext_head {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.dm-imgtext-list { .dm-imgtext-list {
width: 100%; width: 100%;
&>.dm-imgtext-item { & > .dm-imgtext-item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 10px; padding: 10px;
border-bottom: 1px solid #e7e7eb; border-bottom: 1px solid #e7e7eb;
}
.dm-imgtext_left {
& > img {
width: 100px;
height: 100px;
display: inline-block;
vertical-align: middle;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
} }
.dm-imgtext_left{ & > div {
&>img { display: inline-block;
width: 100px; vertical-align: middle;
height: 100px; line-height: 26px;
display:inline-block; padding-left: 10px;
vertical-align: middle;
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
}
&>div{
display: inline-block;
vertical-align: middle;
line-height: 26px;
padding-left: 10px;
}
} }
}
} }
</style> </style>
...@@ -2,76 +2,76 @@ ...@@ -2,76 +2,76 @@
<el-dialog class="sync-imgtext__dialog" title="同步微信图文" :visible.sync="show" width="30%" :before-close="close" v-loading="loading"> <el-dialog class="sync-imgtext__dialog" title="同步微信图文" :visible.sync="show" width="30%" :before-close="close" v-loading="loading">
<div class="gic-modal-bd text-center"> <div class="gic-modal-bd text-center">
<div class="gic-modal-content"> <div class="gic-modal-content">
<p class="fz16" style="margin-bottom:20px">微信图文共<span> {{count}} </span><span @click="getSyncInfo" class="blue" style="margin-left:10px;">刷新</span></p> <p class="fz16" style="margin-bottom:20px">
微信图文共<span> {{ count }} </span><span @click="getSyncInfo" class="blue" style="margin-left:10px;">刷新</span>
</p>
<p class="gray fz12">同步全部图文可能会需要比较久的时间,请耐心等待</p> <p class="gray fz12">同步全部图文可能会需要比较久的时间,请耐心等待</p>
</div> </div>
</div> </div>
<div class="text-center pt20"> <div class="text-center pt20">
<el-select class="w100" v-if="loadStatus === 1 && count!==0" v-model="size" placeholder="选择群发类型"> <el-select class="w100" v-if="loadStatus === 1 && count !== 0" v-model="size" placeholder="选择群发类型">
<el-option v-for="item in sizeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in sizeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> </el-select>
<el-button v-if="loadStatus === 1" type="primary" @click="syncWechat()">立即同步</el-button> <el-button v-if="loadStatus === 1" type="primary" @click="syncWechat()">立即同步</el-button>
<el-button v-if="loadStatus === 0" type="primary" :loading="true">同步中</el-button> <el-button v-if="loadStatus === 0" type="primary" :loading="true">同步中</el-button>
<el-button v-if="loadStatus === 3" icon="el-icon-error" type="danger" >同步失败</el-button> <el-button v-if="loadStatus === 3" icon="el-icon-error" type="danger">同步失败</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import {getSyncInfo,syncWechatImageText} from '@/service/api/wechatApi.js'; import { getSyncInfo, syncWechatImageText } from '@/service/api/wechatApi.js';
export default { export default {
props:{ props: {
show:{ show: {
type:Boolean, type: Boolean,
default:false default: false
} }
}, },
watch: { watch: {
show(val) { show(val) {
if (val) { if (val) {
this.getSyncInfo(); this.getSyncInfo();
} }
} }
}, },
data() { data() {
return { return {
loadStatus:1, loadStatus: 1,
loading:false, loading: false,
count:0, count: 0,
size:5, size: 5,
sizeOptions:[{label:'5条',value:5},{label:'10条',value:10},{label:'20条',value:20},{label:'全部',value:999999}] sizeOptions: [{ label: '5条', value: 5 }, { label: '10条', value: 10 }, { label: '20条', value: 20 }, { label: '全部', value: 999999 }]
}; };
},
methods: {
close() {
this.$emit('update:show', false);
},
async getSyncInfo() {
this.loading = true;
let res = await getSyncInfo();
this.count = res.result.wechatCount;
this.loadStatus = res.result.status;
this.loading = false;
}, },
methods: { async syncWechat() {
close() { this.loadStatus = 0;
this.$emit('update:show',false); const num = this.size === 999999 ? this.count : this.size;
}, let res = await syncWechatImageText({ num });
async getSyncInfo() { if (num <= 20 && res.errorCode === 0) {
this.loading = true; this.$tips({ type: 'success', message: '同步成功' });
let res = await getSyncInfo(); this.loadStatus = 1;
this.count = res.result.wechatCount; this.close();
this.loadStatus = res.result.status;
this.loading = false;
},
async syncWechat(){
this.loadStatus = 0;
const num = this.size === 999999?this.count:this.size
let res = await syncWechatImageText({num});
if(num <= 20 && res.errorCode === 0) {
this.$tips({type:'success',message:"同步成功"});
this.loadStatus = 1;
this.close();
}
} }
} }
}; }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.gic-modal-content { .gic-modal-content {
font-size: 18px; font-size: 18px;
color: #333; color: #333;
margin-top: 30px; margin-top: 30px;
font-size: 16px; font-size: 16px;
} }
</style> </style>
<template> <template>
<section class="sms-lib"> <section class="sms-lib">
<div :class="pbSize"> <div :class="pbSize">
<span class="pr10">选择短信模板(共{{total}}条)</span><el-input clearable v-model="listParams.search" class="w200" placeholder="请输入标题/作者" @change="LoadTempList"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input> <span class="pr10">选择短信模板(共{{ total }}条)</span><el-input clearable v-model="listParams.search" class="w200" placeholder="请输入标题/作者" @change="LoadTempList"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input>
</div> </div>
<el-table tooltipEffect="light" :data="smsTempList" style="width: 100%" v-loading="loading" @row-click="rowClick"> <el-table tooltipEffect="light" :data="smsTempList" style="width: 100%" v-loading="loading" @row-click="rowClick">
<el-table-column :show-overflow-tooltip="false" :width="60" align="center" prop="smsTemplateId"> <el-table-column :show-overflow-tooltip="false" :width="60" align="center" prop="smsTemplateId">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="sms-record_left label-hidden"> <div class="sms-record_left label-hidden">
<el-radio v-model="activeSmsId" :label="scope.row.smsTemplateId" class="pr10"></el-radio> <el-radio v-model="activeSmsId" :label="scope.row.smsTemplateId" class="pr10"></el-radio>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :show-overflow-tooltip="false" :width="200" :min-width="200" align="left" prop="title" label="模板名称"></el-table-column> <el-table-column :show-overflow-tooltip="false" :width="200" :min-width="200" align="left" prop="title" label="模板名称"></el-table-column>
<el-table-column :show-overflow-tooltip="false" :width="200" :min-width="200" align="left" prop="content" label="模板类型"> <el-table-column :show-overflow-tooltip="false" :width="200" :min-width="200" align="left" prop="content" label="模板类型">
<template slot-scope="scope"> <template slot-scope="scope">
<p class="gray">{{scope.row.type === 0 ?'普通短信' :(scope.row.type === 1?'营销短信':'验证码')}}</p> <p class="gray">{{ scope.row.type === 0 ? '普通短信' : scope.row.type === 1 ? '营销短信' : '验证码' }}</p>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :show-overflow-tooltip="false" :min-width="200" align="left" prop="content" label="模板内容"> <el-table-column :show-overflow-tooltip="false" :min-width="200" align="left" prop="content" label="模板内容">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{scope.row.content}}</div> <div>{{ scope.row.content }}</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination v-show="smsTempList.length" background class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"></el-pagination> <el-pagination v-show="smsTempList.length" background class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"></el-pagination>
</section> </section>
</template> </template>
<script> <script>
import {LoadTempList} from '@/service/api/messageApi.js'; import { LoadTempList } from '@/service/api/messageApi.js';
export default { export default {
props:{ props: {
pbSize:{ pbSize: {
type:String, type: String,
default:'pb22' default: 'pb22'
}, },
activeId:String, activeId: String
}, },
data(){ data() {
return{ return {
listParams:{ listParams: {
search:'', search: '',
currentPage:1, currentPage: 1,
pageSize:20 pageSize: 20
}, },
total:0, total: 0,
smsTempList:[], smsTempList: [],
activeSmsId:'' activeSmsId: ''
} };
}, },
watch:{ watch: {
activeId(val) { activeId(val) {
this.activeSmsId = val; this.activeSmsId = val;
} }
}, },
created(){ created() {
this.LoadTempList(); this.LoadTempList();
}, },
methods:{ methods: {
rowClick(row) { rowClick(row) {
this.activeSmsId = row.smsTemplateId; this.activeSmsId = row.smsTemplateId;
this.$emit('update:activeId',row.smsTemplateId); this.$emit('update:activeId', row.smsTemplateId);
this.$emit('emitSmsItemInfo',row); this.$emit('emitSmsItemInfo', row);
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.listParams.pageSize = val; this.listParams.pageSize = val;
this.LoadTempList(); this.LoadTempList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.listParams.currentPage = val; this.listParams.currentPage = val;
this.LoadTempList(); this.LoadTempList();
}, },
async LoadTempList() { async LoadTempList() {
this.loading = true; this.loading = true;
let res = await LoadTempList(this.listParams); let res = await LoadTempList(this.listParams);
this.smsTempList = res.result.result || []; this.smsTempList = res.result.result || [];
this.total = res.result.totalCount; this.total = res.result.totalCount;
this.loading = false; this.loading = false;
}, },
reset() { reset() {
this.listParams.search = ''; this.listParams.search = '';
this.LoadTempList(); this.LoadTempList();
}, }
} }
} };
</script> </script>
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
import memberInfo from "./index.vue"; import memberInfo from './index.vue';
const gicMemberInfo = { const gicMemberInfo = {
install(Vue, options) { install(Vue, options) {
Vue.component(memberInfo.name, memberInfo) Vue.component(memberInfo.name, memberInfo);
} }
} };
if (typeof window !== 'undefined' && window.Vue) { if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(gicMemberInfo); window.Vue.use(gicMemberInfo);
} }
......
<template> <template>
<el-popover placement="top-start" width="400" height="180" trigger="hover" @show="getSingleInfo"> <el-popover placement="top-start" width="400" height="180" trigger="hover" @show="getSingleInfo">
<div class="pointer" @click="linkDetail"> <div class="pointer" @click="linkDetail">
<div class="singelinfo"> <div class="singelinfo">
<div class="singelinfo-img"><img width="100" height="100" :src="filterAvatar(singleInfo.photoUrl)" alt=""></div> <div class="singelinfo-img"><img width="100" height="100" :src="filterAvatar(singleInfo.photoUrl)" alt="" /></div>
<div class="singelinfo-content pl10 pr10"> <div class="singelinfo-content pl10 pr10">
<span class="lheigt">{{ singleInfo.memberName }} <span class="lheigt"
<img :title="singleInfo.status == 0 ? '取消关注公众号' : singleInfo.status == 1 ? '已关注公众号' : '未关注公众号'" class="fr" >{{ singleInfo.memberName }}
:src="singleInfo.status == 0 ? gzhiconcanclegray : singleInfo.status == 1 ? gzhicon : gzhicongray" /> <img :title="singleInfo.status == 0 ? '取消关注公众号' : singleInfo.status == 1 ? '已关注公众号' : '未关注公众号'" class="fr" :src="singleInfo.status == 0 ? gzhiconcanclegray : singleInfo.status == 1 ? gzhicon : gzhicongray" />
<img :title="singleInfo.wxStatus == 0 ? '未使用小程序' : singleInfo.wxStatus == 1 ? '使用过小程序' : ''" class="channelicon fr mr6" <img :title="singleInfo.wxStatus == 0 ? '未使用小程序' : singleInfo.wxStatus == 1 ? '使用过小程序' : ''" class="channelicon fr mr6" :src="singleInfo.wxStatus == 0 ? xcxicongray : singleInfo.wxStatus == 1 ? xcxicon : ''" />
:src="singleInfo.wxStatus == 0 ? xcxicongray : singleInfo.wxStatus == 1 ? xcxicon : ''"/> </span>
</span> <p class="lheigth0">
<p class="lheigth0"> <span class="evl-right">{{ singleInfo.sex }}</span>
<span class="evl-right">{{ singleInfo.sex}}</span> <span class="evl-right">{{ singleInfo.age }}</span>
<span class="evl-right">{{ singleInfo.age }}</span> <span :title="singleInfo.cardNo">{{ singleInfo.cardNo | formatCardName }}</span>
<span :title="singleInfo.cardNo">{{ singleInfo.cardNo | formatCardName }}</span></p> </p>
<p class="lheigth0"><span>{{ singleInfo.mainStoreName }}</span></p> <p class="lheigth0">
<div class="singelinfo-cost"> <span>{{ singleInfo.mainStoreName }}</span>
<div class="singelinfo-costitem"><p>{{ singleInfo.costFee }}</p><p>消费总额</p></div> </p>
<div class="singelinfo-costitem"><p>{{ singleInfo.costTimes }}</p><p>消费次数</p></div> <div class="singelinfo-cost">
<div class="singelinfo-costitem"><p>{{ singleInfo.lastCost }}</p><p>最近消费</p></div> <div class="singelinfo-costitem">
<p>{{ singleInfo.costFee }}</p>
<p>消费总额</p>
</div>
<div class="singelinfo-costitem">
<p>{{ singleInfo.costTimes }}</p>
<p>消费次数</p>
</div>
<div class="singelinfo-costitem">
<p>{{ singleInfo.lastCost }}</p>
<p>最近消费</p>
</div> </div>
</div> </div>
</div> </div>
<div class="singelinfo-jl mb20 mt20">
<a class="singelinfo-jlitem">消费记录 ({{ singleInfo.numOfSale }})</a>
<a class="singelinfo-jlitem">营销记录 ({{ singleInfo.numOfmarket }})</a>
<a class="singelinfo-jlitem">卡券记录 ({{ singleInfo.couponCount }})</a>
</div>
</div> </div>
<span slot="reference"> <div class="singelinfo-jl mb20 mt20">
<a :href="'/member/#/wechatmemberDetail?memberId='+ row.memberId" target="_blank"> <a class="singelinfo-jlitem">消费记录 ({{ singleInfo.numOfSale }})</a>
<img class="vertical-middle table__avatar--40" :src="filterAvatar(row.imageUrl)" width="40" height="40" alt="" srcset=""> <a class="singelinfo-jlitem">营销记录 ({{ singleInfo.numOfmarket }})</a>
<div class="inline-block vertical-middle"> <a class="singelinfo-jlitem">卡券记录 ({{ singleInfo.couponCount }})</a>
<p class="table-name--ellipsis">{{row.memberName || '--'}}</p>
<p class="table-name--ellipsis fz13">{{row.cardNum || '--'}}</p>
</div> </div>
</a> </div>
</span> <span slot="reference">
<a :href="'/member/#/wechatmemberDetail?memberId=' + row.memberId" target="_blank">
<img class="vertical-middle table__avatar--40" :src="filterAvatar(row.imageUrl)" width="40" height="40" alt="" srcset="" />
<div class="inline-block vertical-middle">
<p class="table-name--ellipsis">{{ row.memberName || '--' }}</p>
<p class="table-name--ellipsis fz13">{{ row.cardNum || '--' }}</p>
</div>
</a>
</span>
</el-popover> </el-popover>
</template> </template>
<script> <script>
const host = window.location.origin; const host = window.location.origin;
export const baseUrl = host.indexOf('localhost') !== -1 ? 'http://gicdev.demogic.com/' : host export const baseUrl = host.indexOf('localhost') !== -1 ? 'http://gicdev.demogic.com/' : host;
import qs from 'qs'; import qs from 'qs';
import axios from 'axios'; import axios from 'axios';
export default { export default {
name:'vue-gic-member-info', name: 'vue-gic-member-info',
props:{ props: {
row:{ row: {
type:Object, type: Object,
default(){ default() {
return {} return {};
} }
} }
},
data() {
return {
singleInfo: {},
defaultAvatar: require('./img/head_default.png'),
gzhiconcanclegray: require('./img/status@gzhcanclegray.png'),
gzhicon: require('./img/status@gzh.png'),
gzhicongray: require('./img/status@gzhgray.png'),
xcxicongray: require('./img/status@xcxgray.png'),
xcxicon: require('./img/status@xcx.png')
};
},
methods: {
filterAvatar(img) {
return img ? img.replace(/^http(s)?/, 'https') : this.defaultAvatar;
}, },
data() { getSingleInfo() {
return { axios({
singleInfo:{}, method: 'post',
defaultAvatar:require('./img/head_default.png'), url: baseUrl + '/api-member/load-member-single-info?requestProject=member',
gzhiconcanclegray:require('./img/status@gzhcanclegray.png'), data: JSON.stringify({ memberId: this.row.memberId }),
gzhicon:require('./img/status@gzh.png'), headers: {
gzhicongray:require('./img/status@gzhgray.png'), 'content-type': 'application/json;charset=utf-8'
xcxicongray:require('./img/status@xcxgray.png'),
xcxicon:require('./img/status@xcx.png'),
} }
}, }).then(res => {
methods:{ if (res.data.errorCode === 0) {
filterAvatar(img) { this.singleInfo = res.data.result.memberSingle || {};
return img?img.replace(/^http(s)?/,'https'):this.defaultAvatar;
},
getSingleInfo() {
axios({
method:'post',
url: baseUrl + '/api-member/load-member-single-info?requestProject=member',
data:JSON.stringify({memberId:this.row.memberId}),
headers: {
'content-type':'application/json;charset=utf-8'
}
}).then(res => {
if (res.data.errorCode === 0) {
this.singleInfo = res.data.result.memberSingle || {};
}
})
},
linkDetail() {
window.open(`/member/#/wechatmemberDetail?memberId=${this.row.memberId}`);
} }
});
}, },
filters:{ linkDetail() {
formatCardName(val) { window.open(`/member/#/wechatmemberDetail?memberId=${this.row.memberId}`);
if(val) { }
if(val.length > 10) { },
val = val.substr(0, 10) + '...'; filters: {
} formatCardName(val) {
if (val) {
if (val.length > 10) {
val = val.substr(0, 10) + '...';
} }
return val; }
}, return val;
} }
} }
};
</script> </script>
<style lang="scss"> <style lang="scss">
.singelinfo { .singelinfo {
display: flex;
justify-content: flex-start;
&-img {
flex: 0 0 100px;
}
&-content {
flex: 1;
}
&-wrap {
display: flex; display: flex;
justify-content: flex-start; flex-direction: column;
&-img { }
flex: 0 0 100px; &-item {
} flex: 1;
&-content { line-height: 0;
flex: 1; }
} &-jl {
&-wrap { display: flex;
display: flex; align-items: center;
flex-direction: column; justify-content: center;
} }
&-item { &-jlitem {
flex: 1; flex: 1;
line-height: 0; text-align: center;
} }
&-jl { &-cost {
display: flex; display: flex;
align-items: center; text-align: center;
justify-content: center; }
} &-costitem {
&-jlitem { flex: 1;
flex: 1; }
text-align: center;
}
&-cost {
display: flex;
text-align: center;
}
&-costitem {
flex: 1;
}
} }
.lheigt { .lheigt {
color: #303133; color: #303133;
margin: 5px 0; margin: 5px 0;
span { span {
color: #606266; color: #606266;
} }
} }
</style> </style>
<template> <template>
<div style="display:inline-block;"> <div style="display:inline-block;">
<el-popover class="store__popover" placement="bottom" width="200" trigger="click" v-model="popoverShow"> <el-popover class="store__popover" placement="bottom" width="200" trigger="click" v-model="popoverShow">
<el-input slot="reference" suffix-icon="el-icon-arrow-down" :value="newModel.label" :placeholder="newModel.label?'':placeholder"></el-input> <el-input slot="reference" suffix-icon="el-icon-arrow-down" :value="newModel.label" :placeholder="newModel.label ? '' : placeholder"></el-input>
<el-tree <el-tree style="height: 260px;overflow-y: auto;" ref="tree" node-key="id" :data="treeData" :highlight-current="true" @node-click="handleNodeClick"> </el-tree>
style="height: 260px;overflow-y: auto;"
ref="tree"
node-key="id"
:data="treeData"
:highlight-current="true"
@node-click="handleNodeClick">
</el-tree>
<div class="store-btn-wrap"> <div class="store-btn-wrap">
<span @click="close" class="cursor fz12 pr10 vertical-middle">取消</span> <span @click="close" class="cursor fz12 pr10 vertical-middle">取消</span>
<el-button size="mini" type="text" @click="submit">确定</el-button> <el-button size="mini" type="text" @click="submit">确定</el-button>
</div> </div>
</el-popover> </el-popover>
</div> </div>
</template> </template>
<script> <script>
import {storeGroupList} from '@/service/api/commonApi.js' import { storeGroupList } from '@/service/api/commonApi.js';
export default { export default {
props:{ props: {
placeholder:{ placeholder: {
type:String, type: String,
default:'请选择门店分组' default: '请选择门店分组'
}, },
model:{ model: {
type:Object, type: Object,
default(){ default() {
return {} return {};
} }
}, }
}, },
data() { data() {
return { return {
popoverShow:false, popoverShow: false,
treeData:[], treeData: [],
newModel:Object.assign({},this.model) newModel: Object.assign({}, this.model)
} };
}, },
created(){ created() {
this.storeGroupList(); this.storeGroupList();
}, },
methods:{ methods: {
async storeGroupList() { async storeGroupList() {
let res = await storeGroupList(); let res = await storeGroupList();
const result = res.result; const result = res.result;
...@@ -50,40 +43,39 @@ export default { ...@@ -50,40 +43,39 @@ export default {
list.map(v => { list.map(v => {
v.label = v.storeGroupName; v.label = v.storeGroupName;
v.id = v.storeGroupId; v.id = v.storeGroupId;
if (v.children instanceof Array && v.children.length>0) { if (v.children instanceof Array && v.children.length > 0) {
_rec(v.children); _rec(v.children);
} }
}) });
} }
_rec(result); _rec(result);
this.treeData = result; this.treeData = result;
this.$nextTick(_ => { this.$nextTick(_ => {
this.$refs.tree.setCurrentKey(this.newModel.id); this.$refs.tree.setCurrentKey(this.newModel.id);
}) });
}, },
handleNodeClick(data,node,comp){ handleNodeClick(data, node, comp) {
this.newModel = data; this.newModel = data;
}, },
submit(){ submit() {
this.popoverShow = false; this.popoverShow = false;
this.$emit('commit-store',this.newModel); this.$emit('commit-store', this.newModel);
this.$store.commit('mutations_setStoreObj',this.newModel); this.$store.commit('mutations_setStoreObj', this.newModel);
}, },
close(){ close() {
this.popoverShow = false; this.popoverShow = false;
} }
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.store__popover{ .store__popover {
padding: 0; padding: 0;
} }
.store-btn-wrap{ .store-btn-wrap {
text-align:right; text-align: right;
border-top:1px solid #ebeef5; border-top: 1px solid #ebeef5;
padding-top:10px; padding-top: 10px;
} }
</style> </style>
<template> <template>
<div> <div>
  <span :sendSync="sendSync" :autoStart="autoStart" :defaultVal="defaultVal">{{countString}}</span> <span :sendSync="sendSync" :autoStart="autoStart" :defaultVal="defaultVal">{{ countString }}</span>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name:'time-count', name: 'time-count',
data() { data() {
return { return {
isStart: false, isStart: false,
globalTimer: null, //获取setInterval对象值 globalTimer: null, //获取setInterval对象值
countString: "0秒", //用来显示时间 countString: '0秒', //用来显示时间
day: 0, day: 0,
hour: 0, hour: 0,
minute: 0, minute: 0,
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
millisecond: 0, millisecond: 0,
countVal: this.defaultVal, //获取初始值 countVal: this.defaultVal, //获取初始值
pauseTime: 0, pauseTime: 0,
nowDate:Date.now() nowDate: Date.now()
}; };
}, },
watch: { watch: {
...@@ -65,10 +65,10 @@ export default { ...@@ -65,10 +65,10 @@ export default {
} }
}, },
created() { created() {
this.$on("startCount", function() { this.$on('startCount', function() {
this.startCountFn(); this.startCountFn();
}); });
this.$on("stopCount", function() { this.$on('stopCount', function() {
this.stopCountFn(); this.stopCountFn();
}); });
}, },
...@@ -76,16 +76,16 @@ export default { ...@@ -76,16 +76,16 @@ export default {
counterFn(counterTime) { counterFn(counterTime) {
var nowDate = new Date().getTime(); var nowDate = new Date().getTime();
if (this.pauseTime <= 0) { if (this.pauseTime <= 0) {
var num = counterTime - nowDate; //计算时间毫秒差 var num = counterTime - nowDate; //计算时间毫秒差
} else { } else {
this.pauseTime = this.pauseTime + 10; this.pauseTime = this.pauseTime + 10;
var num = counterTime - this.pauseTime; //计算时间毫秒差 var num = counterTime - this.pauseTime; //计算时间毫秒差
} }
if(num <= 0) { if (num <= 0) {
this.stopCountFn(); this.stopCountFn();
this.$nextTick(_ => { this.$nextTick(_ => {
this.countString = ''; this.countString = '';
}) });
} }
var leave1 = num % (24 * 3600 * 1000); //计算天数后剩余的毫秒数 var leave1 = num % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数 var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
...@@ -95,9 +95,7 @@ export default { ...@@ -95,9 +95,7 @@ export default {
this.minute = Math.floor(leave2 / (60 * 1000)); //计算相差分钟 this.minute = Math.floor(leave2 / (60 * 1000)); //计算相差分钟
this.second = Math.round(leave3 / 1000); //计算相差秒 this.second = Math.round(leave3 / 1000); //计算相差秒
if (this.day > 0) { if (this.day > 0) {
this.countString = `${this.day}${this.hour}小时 ${this.minute}${ this.countString = `${this.day}${this.hour}小时 ${this.minute}${this.second}秒`;
this.second
}秒`;
} else if (this.hour > 0) { } else if (this.hour > 0) {
this.countString = `${this.hour}小时 ${this.minute}${this.second}秒`; this.countString = `${this.hour}小时 ${this.minute}${this.second}秒`;
} else if (this.minute > 0) { } else if (this.minute > 0) {
...@@ -125,11 +123,11 @@ export default { ...@@ -125,11 +123,11 @@ export default {
} }
}, },
passToParent(data) { passToParent(data) {
this.$emit("getDataFromChild", data); this.$emit('getDataFromChild', data);
} }
}, },
beforeDestroy() { beforeDestroy() {
this.stopCountFn(); this.stopCountFn();
}, }
}; };
</script> </script>
...@@ -47,30 +47,29 @@ export const postForm = (url, params) => { ...@@ -47,30 +47,29 @@ export const postForm = (url, params) => {
--> -->
<template> <template>
<div class="tinymce-contain"> <div class="tinymce-contain">
<editor id='tinymce' v-model='tinymceHtml' :init='init'></editor> <editor id="tinymce" v-model="tinymceHtml" :init="init"></editor>
</div> </div>
</template> </template>
<script> <script>
// import { getRequest,postForm } from '../../api/api'; // import { getRequest,postForm } from '../../api/api';
import tinymce from 'tinymce/tinymce' import tinymce from 'tinymce/tinymce';
import 'tinymce/themes/modern/theme' import 'tinymce/themes/modern/theme';
import Editor from '@tinymce/tinymce-vue' import Editor from '@tinymce/tinymce-vue';
import 'tinymce/plugins/image' import 'tinymce/plugins/image';
import 'tinymce/plugins/link' import 'tinymce/plugins/link';
import 'tinymce/plugins/code' import 'tinymce/plugins/code';
import 'tinymce/plugins/table' import 'tinymce/plugins/table';
import 'tinymce/plugins/lists' import 'tinymce/plugins/lists';
import 'tinymce/plugins/contextmenu' import 'tinymce/plugins/contextmenu';
import 'tinymce/plugins/wordcount' import 'tinymce/plugins/wordcount';
import 'tinymce/plugins/colorpicker' import 'tinymce/plugins/colorpicker';
import 'tinymce/plugins/textcolor' import 'tinymce/plugins/textcolor';
export default { export default {
name: "tinymce-edit", name: 'tinymce-edit',
props: ["bodyHtml",'projectName'], props: ['bodyHtml', 'projectName'],
data() { data() {
return { return {
// tinymce // tinymce
tinymceHtml: '请输入内容', tinymceHtml: '请输入内容',
init: { init: {
...@@ -84,24 +83,22 @@ export default { ...@@ -84,24 +83,22 @@ export default {
// images_upload_base_path: '/some/basepath', // images_upload_base_path: '/some/basepath',
images_upload_credentials: true, //是否应传递cookie等跨域的凭据 images_upload_credentials: true, //是否应传递cookie等跨域的凭据
// images_upload_handler提供三个参数:blobInfo, success, failure // images_upload_handler提供三个参数:blobInfo, success, failure
images_upload_handler: (blobInfo, success, failure)=>{ images_upload_handler: (blobInfo, success, failure) => {
console.log(blobInfo) console.log(blobInfo);
// this.handleImgUpload(blobInfo, success, failure) // this.handleImgUpload(blobInfo, success, failure)
}, },
// 添加插件 // 添加插件
plugins: 'link lists image code table colorpicker textcolor wordcount contextmenu', plugins: 'link lists image code table colorpicker textcolor wordcount contextmenu',
toolbar: toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent blockquote | undo redo | link unlink image code | removeformat',
'bold italic underline strikethrough | fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent blockquote | undo redo | link unlink image code | removeformat',
branding: false, branding: false,
setup: function(editor) { setup: function(editor) {
// 点击编辑框回调 // 点击编辑框回调
editor.on('click', function(e) { editor.on('click', function(e) {
console.log('Editor was clicked'); console.log('Editor was clicked');
}); });
} }
} }
} };
}, },
methods: { methods: {
...@@ -119,44 +116,42 @@ export default { ...@@ -119,44 +116,42 @@ export default {
// failure('error') // failure('error')
// }) // })
// }, // },
}, },
watch: { watch: {
projectName: function(newData,oldData){ projectName: function(newData, oldData) {
var that = this; var that = this;
// console.log("新数据:",newData,oldData) // console.log("新数据:",newData,oldData)
that.repProjectName = newData || 'gic-web'; that.repProjectName = newData || 'gic-web';
}, },
bodyHtml: function(newData,oldData){ bodyHtml: function(newData, oldData) {
var that = this; var that = this;
// console.log("新数据:",newData,oldData) // console.log("新数据:",newData,oldData)
that.tinymceHtml = newData; that.tinymceHtml = newData;
}, }
}, },
components: { components: {
Editor Editor
}, },
mounted() { mounted() {
var that = this var that = this;
tinymce.init({}); tinymce.init({});
that.tinymceHtml = that.bodyHtml; that.tinymceHtml = that.bodyHtml;
} }
};
}
</script> </script>
<style lang="scss" scoped > <style lang="scss" scoped>
.tinymce-contain { .tinymce-contain {
width: 890px; width: 890px;
/deep/ .mce-tinymce { /deep/ .mce-tinymce {
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
box-shadow: none; box-shadow: none;
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
} }
/deep/ .mce-panel { /deep/ .mce-panel {
border: 0px solid #dcdfe6; border: 0px solid #dcdfe6;
}
} }
}
</style> </style>
<template> <template>
<div class="dm-avatar"> <div class="dm-avatar">
<label class="dm-avatar__upload " :class="{'is-disabled':disabled}" :style="`width:${width}px;height:${height}px;`" v-loading="loading"> <label class="dm-avatar__upload " :class="{ 'is-disabled': disabled }" :style="`width:${width}px;height:${height}px;`" v-loading="loading">
<input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload='this'> <input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload="this" />
<img v-show="model.imgUrl && showImg" :src="model.imgUrl || ''" :class="className" class="dm-avatar__img"/> <img v-show="model.imgUrl && showImg" :src="model.imgUrl || ''" :class="className" class="dm-avatar__img" />
<i class="el-icon-plus dm-avatar__icon" v-show="!model.imgUrl" :style="'line-height:'+height+'px;'"></i> <i class="el-icon-plus dm-avatar__icon" v-show="!model.imgUrl" :style="'line-height:' + height + 'px;'"></i>
</label> </label>
<div class="dm-avatar__tips" :style="tipsStyle"> {{tips}}</div> <div class="dm-avatar__tips" :style="tipsStyle">{{ tips }}</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name:'dm-upload', name: 'dm-upload',
props:{ props: {
model:{ model: {
type:Object, type: Object,
default(){ default() {
return { return {
code:'', code: '',
imgUrl:'', imgUrl: '',
wxImg:'', wxImg: '',
mediaId:'' mediaId: ''
} };
} }
}, },
width:{ width: {
type:String, type: String,
default:'auto' default: 'auto'
}, },
height:{ height: {
type:String, type: String,
default:'auto' default: 'auto'
}, },
tips:{ tips: {
type:String, type: String,
default:'图片建议尺寸:100*100' default: '图片建议尺寸:100*100'
}, },
className:{ className: {
type:String, type: String,
default:'' default: ''
}, },
label:{ label: {
type:String, type: String,
default:'上传' default: '上传'
}, },
fileType:{ fileType: {
type:String, type: String,
default:'file' default: 'file'
}, },
showImg:{ showImg: {
type:Boolean, type: Boolean,
default:true default: true
}, },
tipsStyle:Object, tipsStyle: Object,
size: String, size: String,
url:{ url: {
type:String, type: String,
default:'/api-marketing/upload-game-image' default: '/api-marketing/upload-game-image'
}, },
labelStyle:Object labelStyle: Object
}, },
data() { data() {
return { return {
loading:false, loading: false,
disabled:false disabled: false
} };
}, },
watch:{ watch: {
model:{ model: {
handler(val) { handler(val) {
this.$emit('update:model',this.model); this.$emit('update:model', this.model);
this.$emit('backImg',this.model); this.$emit('backImg', this.model);
}, },
deep:true deep: true
} }
}, }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dm-avatar{ .dm-avatar {
&__upload { &__upload {
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
border-radius: 6px; border-radius: 6px;
...@@ -91,12 +91,12 @@ export default { ...@@ -91,12 +91,12 @@ export default {
outline: none; outline: none;
width: 178px; width: 178px;
height: 178px; height: 178px;
&:hover{ &:hover {
box-shadow: 0 0 8px 0 rgba(232,237,250,.6), 0 2px 4px 0 rgba(232,237,250,.5); box-shadow: 0 0 8px 0 rgba(232, 237, 250, 0.6), 0 2px 4px 0 rgba(232, 237, 250, 0.5);
border-color: #1890ff; border-color: #1890ff;
} }
} }
&__img{ &__img {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: block; display: block;
...@@ -109,11 +109,10 @@ export default { ...@@ -109,11 +109,10 @@ export default {
line-height: 178px; line-height: 178px;
text-align: center; text-align: center;
} }
&__tips{ &__tips {
color:#909399; color: #909399;
font-size:12px; font-size: 12px;
line-height:1; line-height: 1;
} }
} }
</style> </style>
<template> <template>
<el-upload <el-upload class="avatar-uploader" action="123" :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
class="avatar-uploader" <div v-if="imgUrl" :src="imgUrl" class="avatar" :style="'background-image:url(' + imgUrl + ')'"></div>
action="123" <p v-else class="avatar-uploader-icon"><i class="el-icon-picture"></i><span>点击添加图片</span></p>
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<div v-if="imgUrl" :src="imgUrl" class="avatar" :style="'background-image:url('+imgUrl+')'"></div>
<p v-else class="avatar-uploader-icon">
<i class="el-icon-picture"></i><span>点击添加图片</span>
</p>
</el-upload> </el-upload>
</template> </template>
<script> <script>
// *.3gpp audio/3gpp, video/3gpp 3GPP Audio/Video // *.3gpp audio/3gpp, video/3gpp 3GPP Audio/Video
// *.ac3 audio/ac3 AC3 Audio // *.ac3 audio/ac3 AC3 Audio
// *.asf allpication/vnd.ms-asf Advanced Streaming Format // *.asf allpication/vnd.ms-asf Advanced Streaming Format
...@@ -61,103 +53,104 @@ ...@@ -61,103 +53,104 @@
// *.xml text/xml, application/xml Extensible Markup Language // *.xml text/xml, application/xml Extensible Markup Language
// *.zip aplication/zip Compressed Archive // *.zip aplication/zip Compressed Archive
import config from '@/config'; import config from '@/config';
export default { export default {
props:{ props: {
url:{ url: {
type:String, type: String,
default:'/api-plug/upload-img' default: '/api-plug/upload-img'
},
imgUrl:{
type:String,
default:''
},
imgCode:{
type:String,
default:''
},
}, },
data() { imgUrl: {
return { type: String,
code:'', default: ''
disabled:false, },
loading:false imgCode: {
}; type: String,
default: ''
}
},
data() {
return {
code: '',
disabled: false,
loading: false
};
},
methods: {
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
}, },
methods: { beforeAvatarUpload(file) {
handleAvatarSuccess(res, file) { const isJPG = file.type === 'image/jpeg';
this.imageUrl = URL.createObjectURL(file.raw); const isLt2M = file.size / 1024 / 1024 < 2;
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg';
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) { if (!isJPG) {
this.$message.warning('只能上传JPG格式文件!'); this.$message.warning('只能上传JPG格式文件!');
return; return;
} }
if (!isLt2M) { if (!isLt2M) {
this.$message.warning('上传头像图片大小不能超过 2MB!'); this.$message.warning('上传头像图片大小不能超过 2MB!');
return; return;
} }
let formData = new FormData(); let formData = new FormData();
formData.append('file',file); formData.append('file', file);
formData.append('requestProject', 'gic-web'); formData.append('requestProject', 'gic-web');
this.axios.post(this.url, formData).then(res => { this.axios
.post(this.url, formData)
.then(res => {
if (res.data.errorCode === 0) { if (res.data.errorCode === 0) {
this.$emit('update:imgUrl',res.data.result[0].qcloudImageUrl) this.$emit('update:imgUrl', res.data.result[0].qcloudImageUrl);
this.$emit('update:imgCode',res.data.result[0].imageFiledCode) this.$emit('update:imgCode', res.data.result[0].imageFiledCode);
this.$tips({ type: 'success', message: '上传成功' }); this.$tips({ type: 'success', message: '上传成功' });
} else { } else {
this.$tips({ type: 'error', message: '上传失败' }); this.$tips({ type: 'error', message: '上传失败' });
} }
this.disabled = false; this.disabled = false;
}).catch(error => { })
.catch(error => {
this.disabled = false; this.disabled = false;
this.$tips({ type: 'error', message: error.msg || '上传失败' }); this.$tips({ type: 'error', message: error.msg || '上传失败' });
}); });
}
} }
} }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.avatar-uploader{ .avatar-uploader {
/deep/ .el-upload { /deep/ .el-upload {
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
border-radius: 6px; border-radius: 6px;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
&:hover { &:hover {
border-color: #1890ff; border-color: #1890ff;
}
} }
.avatar-uploader-icon { }
width: 397px; .avatar-uploader-icon {
height: 222px; width: 397px;
text-align: center; height: 222px;
display: flex; text-align: center;
justify-content: center; display: flex;
align-items: center; justify-content: center;
flex-direction: column; align-items: center;
i{ flex-direction: column;
font-size: 40px; i {
color: #c0c4cc; font-size: 40px;
} color: #c0c4cc;
span {
display: block;
font-size: 16px;
color: #909399;
}
} }
.avatar { span {
width: 397px; display: block;
height: 222px; font-size: 16px;
background-repeat: no-repeat; color: #909399;
background-position: center;
background-size: cover;
} }
} }
.avatar {
width: 397px;
height: 222px;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
}
</style> </style>
<template> <template>
<div> <div>
<label class="el-button el-button--primary el-button--medium" :class="{'is-disabled':disabled}">{{disabled?'上传中...':label}} <label class="el-button el-button--primary el-button--medium" :class="{ 'is-disabled': disabled }"
<input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload='this'> >{{ disabled ? '上传中...' : label }}
</label> <input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload="this" />
<span class="fz12 gray" :style="tipsStyle"> {{tips}}</span> </label>
<span class="fz12 gray" :style="tipsStyle"> {{ tips }}</span>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name:'dm-upload', name: 'dm-upload',
props:{ props: {
model:{ model: {
type:Object, type: Object,
default(){ default() {
return { return {
code:'', code: '',
imgUrl:'', imgUrl: '',
wxImg:'' wxImg: ''
} };
} }
}, },
width:{ width: {
type:String, type: String,
default:'auto' default: 'auto'
}, },
tips:{ tips: {
type:String, type: String,
default:'图片建议尺寸:100*100' default: '图片建议尺寸:100*100'
}, },
className:{ className: {
type:String, type: String,
default:'' default: ''
}, },
label:{ label: {
type:String, type: String,
default:'上传' default: '上传'
}, },
fileType:{ fileType: {
type:String, type: String,
default:'file' default: 'file'
}, },
showImg:{ showImg: {
type:Boolean, type: Boolean,
default:true default: true
}, },
tipsStyle:Object tipsStyle: Object
}, },
watch:{ watch: {
model:{ model: {
handler(val) { handler(val) {
this.$emit('update:model',this.model); this.$emit('update:model', this.model);
this.$emit('backImg',this.model); this.$emit('backImg', this.model);
}, },
deep:true deep: true
} }
}, },
data(){ data() {
return{ return {
disabled:false, disabled: false,
loading:false loading: false
} };
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.upload-show-img{ .upload-show-img {
height: 85px; height: 85px;
display: block; display: block;
margin-top: 10px; margin-top: 10px;
cursor: pointer; cursor: pointer;
} }
</style> </style>
<template> <template>
<div> <div>
<label class="el-button el-button--primary" :class="{'is-disabled':copyDisabled}" :style="labelStyle"> <label class="el-button el-button--primary" :class="{ 'is-disabled': copyDisabled }" :style="labelStyle">
<i v-if="icon" :class="icon"></i> <i v-if="icon" :class="icon"></i>
{{label}} {{ label }}
<input type="file" style="display:none;" :disabled="copyDisabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload='this'> <input type="file" style="display:none;" :disabled="copyDisabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload="this" />
</label> </label>
<span class="fz12 gray" :style="tipsStyle"> {{tips}}</span> <span class="fz12 gray" :style="tipsStyle"> {{ tips }}</span>
<img v-if="model.imgUrl && showImg" :src="model.imgUrl || ''" :width="width" :class="className" class="upload-show-img"/> <img v-if="model.imgUrl && showImg" :src="model.imgUrl || ''" :width="width" :class="className" class="upload-show-img" />
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name:'dm-upload', name: 'dm-upload',
props:{ props: {
model:{ model: {
type:Object, type: Object,
default(){ default() {
return { return {
code:'', code: '',
imgUrl:'', imgUrl: '',
wxImg:'', wxImg: '',
mediaId:'' mediaId: ''
} };
} }
}, },
width:{ width: {
type:String, type: String,
default:'auto' default: 'auto'
}, },
tips:{ tips: {
type:String, type: String,
default:'图片建议尺寸:100*100' default: '图片建议尺寸:100*100'
}, },
className:{ className: {
type:String, type: String,
default:'' default: ''
}, },
label:{ label: {
type:String, type: String,
default:'上传' default: '上传'
}, },
fileType:{ fileType: {
type:String, type: String,
default:'file' default: 'file'
}, },
showImg:{ showImg: {
type:Boolean, type: Boolean,
default:true default: true
}, },
tipsStyle:Object, tipsStyle: Object,
size: String, size: String,
url:{ url: {
type:String, type: String,
default:'/api-marketing/upload-game-image' default: '/api-marketing/upload-game-image'
}, },
labelStyle:Object, labelStyle: Object,
icon:{ icon: {
type:String, type: String,
default:'' default: ''
}, },
disabled:{ disabled: {
type:Boolean, type: Boolean,
default:false default: false
} }
}, },
watch:{ watch: {
model:{ model: {
handler(val) { handler(val) {
this.$emit('update:model',this.model); this.$emit('update:model', this.model);
this.$emit('backImg',this.model); this.$emit('backImg', this.model);
this.copyDisabled = this.disabled; this.copyDisabled = this.disabled;
}, },
deep:true deep: true
} }
}, },
data(){ data() {
return{ return {
copyDisabled:false, copyDisabled: false,
loading:false loading: false
} };
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.upload-show-img{ .upload-show-img {
height: 85px; height: 85px;
display: block; display: block;
margin-top: 10px; margin-top: 10px;
cursor: pointer; cursor: pointer;
} }
</style> </style>
<template> <template>
<div> <div>
<label class="el-button el-button--primary el-button--medium" :class="{'is-disabled':disabled}">{{disabled?'上传中...':label}} <label class="el-button el-button--primary el-button--medium" :class="{ 'is-disabled': disabled }"
<input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload='this'> >{{ disabled ? '上传中...' : label }}
</label> <input type="file" style="display:none;" :disabled="disabled" accept="image/gif, image/jpeg,image/png" ref="uploader" v-upload="this" />
<span class="fz12 gray"> {{tips}}</span> </label>
<img v-if="model.imgUrl" :src="model.imgUrl || ''" :width="width" :class="className" class="upload-show-img"/> <span class="fz12 gray"> {{ tips }}</span>
<img v-if="model.imgUrl" :src="model.imgUrl || ''" :width="width" :class="className" class="upload-show-img" />
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name:'dm-upload', name: 'dm-upload',
props:{ props: {
model:{ model: {
type:Object, type: Object,
default(){ default() {
return { return {
code:'', code: '',
imgUrl:'', imgUrl: '',
wxImg:'' wxImg: ''
} };
} }
}, },
width:{ width: {
type:String, type: String,
default:'auto' default: 'auto'
}, },
tips:{ tips: {
type:String, type: String,
default:'图片建议尺寸:100*100' default: '图片建议尺寸:100*100'
}, },
className:{ className: {
type:String, type: String,
default:'' default: ''
}, },
label:{ label: {
type:String, type: String,
default:'上传' default: '上传'
}, },
fileType:{ fileType: {
type:String, type: String,
default:'file' default: 'file'
} }
}, },
watch:{ watch: {
model:{ model: {
handler(val) { handler(val) {
this.$emit('update:model',this.model) this.$emit('update:model', this.model);
}, },
deep:true deep: true
} }
}, },
data(){ data() {
return{ return {
disabled:false, disabled: false,
loading:false loading: false
} };
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.upload-show-img{ .upload-show-img {
height: 85px; height: 85px;
display: block; display: block;
margin-top: 10px; margin-top: 10px;
cursor: pointer; cursor: pointer;
} }
</style> </style>
<template> <template>
<el-dialog title="添加链接" :visible.sync="show" width="820px" :before-close="close" :append-to-body="true"> <el-dialog title="添加链接" :visible.sync="show" width="820px" :before-close="close" :append-to-body="true">
<el-form label-width="80px"> <el-form label-width="80px">
<el-form-item label="文本内容"> <el-form-item label="文本内容">
<dm-input :maxlength="50" v-model="linkText" class="w300"></dm-input> <dm-input :maxlength="50" v-model="linkText" class="w300"></dm-input>
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
<el-radio :label="0">网址</el-radio> <el-radio :label="0">网址</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<p class="pl20 pb20">已选择链接:{{urlInfo.url || '--'}}</p> <p class="pl20 pb20">已选择链接:{{ urlInfo.url || '--' }}</p>
<innerUrl class="ml30" v-if="h5Type === 1" @sendRightUrl="getRightUrl" @sendLeftUrl="getLeftUrl" @sendShopData="getShopData"></innerUrl> <innerUrl class="ml30" v-if="h5Type === 1" @sendRightUrl="getRightUrl" @sendLeftUrl="getLeftUrl" @sendShopData="getShopData"></innerUrl>
<div class="ml30 clearfix" v-if="h5Type === 0" > <div class="ml30 clearfix" v-if="h5Type === 0">
<el-input v-model="urlInfo.url" class="w300" @blur="checkUrl" placeholder="请输入网址 http或https开头"></el-input> <el-input v-model="urlInfo.url" class="w300" @blur="checkUrl" placeholder="请输入网址 http或https开头"></el-input>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="小程序链接" name="1" v-if="showWxApp"> <el-tab-pane label="小程序链接" name="1" v-if="showWxApp">
<p class="pt10 pl20 pb20">已选择链接:{{urlInfo.url || '--'}}</p> <p class="pt10 pl20 pb20">已选择链接:{{ urlInfo.url || '--' }}</p>
<linktoolspage ref="childlinktoolspage" :isWx="true" :activeName="true" :showType="2" @linkSelect="linkSelect"/> <linktoolspage ref="childlinktoolspage" :isWx="true" :activeName="true" :showType="2" @linkSelect="linkSelect" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-form> </el-form>
...@@ -40,91 +40,91 @@ import linktoolspage from '@/components/linktools/linktoolspage.vue'; ...@@ -40,91 +40,91 @@ import linktoolspage from '@/components/linktools/linktoolspage.vue';
/** /**
* 验证是否为网址 * 验证是否为网址
*/ */
const checkUrl = function (urlString) { const checkUrl = function(urlString) {
if(urlString!=""){ if (urlString != '') {
var reg=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/; var reg = /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;
if(!reg.test(urlString)){ if (!reg.test(urlString)) {
Vue.prototype.$message({type:"warning",message:"网址不规范,示例:http://www.domain.com"}); Vue.prototype.$message({ type: 'warning', message: '网址不规范,示例:http://www.domain.com' });
return true; return true;
} }
}else { } else {
Vue.prototype.$message({type:"warning",message:"网址不规范,示例:http://www.domain.com"}); Vue.prototype.$message({ type: 'warning', message: '网址不规范,示例:http://www.domain.com' });
return true; return true;
} }
return false; return false;
} };
export default { export default {
components:{ components: {
innerUrl, innerUrl,
linktoolspage linktoolspage
}, },
props: { props: {
show: { show: {
type:Boolean, type: Boolean,
default:false default: false
}, },
obj:{ obj: {
type:Object, type: Object,
default() { default() {
return { return {
name:'', name: '',
url:'', url: '',
type:1 type: 1
} };
}, }
}, },
jumpUrlInfo:{ jumpUrlInfo: {
type:Object, type: Object,
default() { default() {
return {} return {};
} }
}, },
urlType:{ urlType: {
type:Boolean | String, type: Boolean | String,
default:0 default: 0
}, },
appendToBody: { appendToBody: {
type:Boolean, type: Boolean,
default:false default: false
}, },
showWxApp:{ showWxApp: {
type:Boolean, type: Boolean,
default:true default: true
} }
}, },
watch:{ watch: {
show(val) { show(val) {
// urlType: '0: 未选择URL; 1.H5链接; 2.小程序url链接 // urlType: '0: 未选择URL; 1.H5链接; 2.小程序url链接
if(val) { if (val) {
if (this.urlType == 1) { if (this.urlType == 1) {
this.activeName = '0'; this.activeName = '0';
} else if (this.urlType == 2) { } else if (this.urlType == 2) {
this.activeName = '1'; this.activeName = '1';
} }
this.linkText = this.jumpUrlInfo.name || ''; this.linkText = this.jumpUrlInfo.name || '';
this.urlInfo.url = this.jumpUrlInfo.url || ''; this.urlInfo.url = this.jumpUrlInfo.url || '';
} }
} }
}, },
data() { data() {
return { return {
linkText:'', linkText: '',
activeName:'0', activeName: '0',
url:'', url: '',
h5Type:1, h5Type: 1,
urlInfo:{name:'',url:'',isWxApp:false,urlType:0}, urlInfo: { name: '', url: '', isWxApp: false, urlType: 0 }
} };
}, },
methods:{ methods: {
close() { close() {
this.$emit('update:show',false); this.$emit('update:show', false);
}, },
async submit() { async submit() {
// 去除前后空格 // 去除前后空格
this.urlInfo.name = this.linkText.replace(/(^\s*)|(\s*$)/g,""); this.urlInfo.name = this.linkText.replace(/(^\s*)|(\s*$)/g, '');
if (!this.urlInfo.name) { if (!this.urlInfo.name) {
this.$tips({type:'warning',message:'链接文本不能为空'}); this.$tips({ type: 'warning', message: '链接文本不能为空' });
return; return;
} }
// 判断是否为小程序 // 判断是否为小程序
...@@ -134,28 +134,30 @@ export default { ...@@ -134,28 +134,30 @@ export default {
// 如果是H5链接 需要转换 // 如果是H5链接 需要转换
if (this.activeName == '0' && this.h5Type === 1 && this.urlInfo.url.indexOf('https://open.weixin.qq.com/connect/oauth2/authorize') < 0) { if (this.activeName == '0' && this.h5Type === 1 && this.urlInfo.url.indexOf('https://open.weixin.qq.com/connect/oauth2/authorize') < 0) {
let params = { let params = {
url:this.urlInfo.url, url: this.urlInfo.url,
requestProject:'marketing' requestProject: 'marketing'
} };
let res = await this.axios.post('/api-marketing/change-to-WXUrl',qs.stringify(params)); let res = await this.axios.post('/api-marketing/change-to-WXUrl', qs.stringify(params));
this.urlInfo.url = res.data.response.result; this.urlInfo.url = res.data.response.result;
} }
this.$emit('urlInfo',this.urlInfo); this.$emit('urlInfo', this.urlInfo);
this.close(); this.close();
}, },
getRightUrl(data){ getRightUrl(data) {
console.log(data); console.log(data);
this.urlInfo = data; this.urlInfo = data;
}, },
getLeftUrl(data){ getLeftUrl(data) {
console.log(data); console.log(data);
}, },
getShopData(data){ // 获取选择的门店id getShopData(data) {
console.log(data) // 获取选择的门店id
console.log(data);
this.urlInfo = data; this.urlInfo = data;
}, },
// linktoolspage // linktoolspage
linkSelect(val) { // 选择小程序链接的返回值 linkSelect(val) {
// 选择小程序链接的返回值
if (val.url) { if (val.url) {
this.urlInfo.url = val.url; this.urlInfo.url = val.url;
} else { } else {
...@@ -169,10 +171,10 @@ export default { ...@@ -169,10 +171,10 @@ export default {
} }
} }
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.w300{ .w300 {
width: 300px; width: 300px;
} }
.pb10 { .pb10 {
...@@ -182,4 +184,3 @@ export default { ...@@ -182,4 +184,3 @@ export default {
padding-left: 20px; padding-left: 20px;
} }
</style> </style>
<template> <template>
<section class="wx-text"> <section class="wx-text">
<div class="wx-text__content"> <div class="wx-text__content">
<div v-html="textarea" @keyup="textInput(textarea,$event)" ref="myTextarea" contenteditable=true @blur="getTextValue"></div> <div v-html="textarea" @keyup="textInput(textarea, $event)" ref="myTextarea" contenteditable="true" @blur="getTextValue"></div>
</div> </div>
<div class="wx-text__opt clearfix"> <div class="wx-text__opt clearfix">
<a @click="addLink" class="iconfont icon-lianjie" title="添加链接"></a> <a @click="addLink" class="iconfont icon-lianjie" title="添加链接"></a>
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
<p>3.支持换行;不支持富文本格式。</p> <p>3.支持换行;不支持富文本格式。</p>
<p>会员信息变量表:</p> <p>会员信息变量表:</p>
<div class="clearfix"> <div class="clearfix">
<ul class="fl pr10" v-for="(item,index) in 4" :key="index"> <ul class="fl pr10" v-for="(item, index) in 4" :key="index">
<li v-for="(v,i) in options.slice(index*7,(index+1)*7)" :key="i">{{v.number+v.name}}</li> <li v-for="(v, i) in options.slice(index * 7, (index + 1) * 7)" :key="i">{{ v.number + v.name }}</li>
</ul> </ul>
</div> </div>
<a @click="removeLink" class="iconfont icon-17" title="变量" slot="reference"></a> <a @click="removeLink" class="iconfont icon-17" title="变量" slot="reference"></a>
...@@ -30,111 +30,117 @@ import myDialog from './dialog'; ...@@ -30,111 +30,117 @@ import myDialog from './dialog';
import strLength from '@/utils/strlen'; import strLength from '@/utils/strlen';
const hrefReg = /href=['"]([^"]*)['"].*?/g; const hrefReg = /href=['"]([^"]*)['"].*?/g;
export default { export default {
name:'dm-text', name: 'dm-text',
components:{ components: {
'my-dialog':myDialog 'my-dialog': myDialog
}, },
props:{ props: {
value:{ value: {
type:String, type: String,
default:'' default: ''
}, },
appendToBody:{ appendToBody: {
type:Boolean, type: Boolean,
default:false default: false
}, },
jumpUrlInfo:{ jumpUrlInfo: {
type:Object, type: Object,
default() { default() {
return {} return {};
} }
}, },
urlType:{ urlType: {
type:Boolean | String, type: Boolean | String,
default:0 default: 0
}, },
isSupportVar:{ isSupportVar: {
type:Boolean, type: Boolean,
default:false default: false
}, },
showWxApp:{ showWxApp: {
type:Boolean, type: Boolean,
default:true default: true
} }
}, },
watch:{ watch: {
value:{ value: {
handler(val) { handler(val) {
if (val) { if (val) {
// debugger // debugger
console.log(val) console.log(val);
this.textarea = val; this.textarea = val;
this.computedTextLength(); this.computedTextLength();
} }
}, },
immediate:true immediate: true
} }
}, },
data() { data() {
return { return {
textarea:'', textarea: '',
dialogShow:false, dialogShow: false,
appid:'', appid: '',
options:require('./options.js'), options: require('./options.js'),
textLength:0 textLength: 0
} };
}, },
created() { created() {
this.getAppid(); this.getAppid();
}, },
methods:{ methods: {
// 添加链接 // 添加链接
addLink() { addLink() {
this.getTextValue(); this.getTextValue();
this.$nextTick(_ => { this.$nextTick(_ => {
console.log(this.$refs.myTextarea.innerHTML) console.log(this.$refs.myTextarea.innerHTML);
this.hasATag(this.$refs.myTextarea.innerHTML,flag => { this.hasATag(this.$refs.myTextarea.innerHTML, flag => {
if (flag) { if (flag) {
this.dialogShow = true; this.dialogShow = true;
} }
}); });
}); });
}, },
textInput(v,e){ // 控制微信文本的文字 textInput(v, e) {
// 控制微信文本的文字
this.computedTextLength(); this.computedTextLength();
}, },
// 获取内容 // 获取内容
getTextValue() { getTextValue() {
const reg = /<(?!(a|\/a|div|\/div|br)).*?>/img ; // 只保留a 和 div 标签 const reg = /<(?!(a|\/a|div|\/div|br)).*?>/gim; // 只保留a 和 div 标签
let text = this.$refs.myTextarea.innerHTML.replace(reg,""); let text = this.$refs.myTextarea.innerHTML.replace(reg, '');
text = text.replace(/<\/div>|&nbsp;/g,"").replace(/<((div)).*?>/g,"<br>").split('<br>').filter(v=>v).join('<br>'); text = text
.replace(/<\/div>|&nbsp;/g, '')
.replace(/<((div)).*?>/g, '<br>')
.split('<br>')
.filter(v => v)
.join('<br>');
this.textarea = text; this.textarea = text;
this.$emit('update:value',text); this.$emit('update:value', text);
}, },
getUrlInfo(obj) { getUrlInfo(obj) {
// console.log(obj) // console.log(obj)
this.hasATag(this.textarea,flag => { this.hasATag(this.textarea, flag => {
if (flag) { if (flag) {
if (obj.isWxApp) { if (obj.isWxApp) {
this.textarea += `<a href="${obj.url}" data-miniprogram-appid="${this.appid}" data-miniprogram-path="${obj.url}">${obj.name}</a>` this.textarea += `<a href="${obj.url}" data-miniprogram-appid="${this.appid}" data-miniprogram-path="${obj.url}">${obj.name}</a>`;
} else { } else {
this.textarea += `<a href="${obj.url}">${obj.name}</a>`; this.textarea += `<a href="${obj.url}">${obj.name}</a>`;
} }
this.$emit('update:urlType',obj.urlType); this.$emit('update:urlType', obj.urlType);
this.$emit('update:jumpUrlInfo',{name:obj.name,url:obj.url}); this.$emit('update:jumpUrlInfo', { name: obj.name, url: obj.url });
this.$emit('update:value',this.textarea); this.$emit('update:value', this.textarea);
} }
}) });
}, },
// 辅助函数 是否有a标签 // 辅助函数 是否有a标签
hasATag(text,cb) { hasATag(text, cb) {
if(hrefReg.test(text)){ if (hrefReg.test(text)) {
var hrefArr = text.match(hrefReg); var hrefArr = text.match(hrefReg);
debugger debugger;
if(hrefArr.length >= 1){ if (hrefArr.length >= 1) {
this.$message({type:'warning',message:'只能添加一个链接'}); this.$message({ type: 'warning', message: '只能添加一个链接' });
cb && cb(false); cb && cb(false);
} else { } else {
cb && cb(true); cb && cb(true);
} }
...@@ -143,27 +149,32 @@ export default { ...@@ -143,27 +149,32 @@ export default {
} }
}, },
getAppid() { getAppid() {
this.axios.post('/api-marketing/get-enterprise-wechat-appid',qs.stringify({ this.axios
requestProject:'marketing' .post(
})).then(res => { '/api-marketing/get-enterprise-wechat-appid',
this.appid = res.data.result; qs.stringify({
console.log(res); requestProject: 'marketing'
}) })
)
.then(res => {
this.appid = res.data.result;
console.log(res);
});
}, },
// 清除a链接 // 清除a链接
removeLink(){ removeLink() {
this.textarea = this.$refs.myTextarea.innerText.replace(/\n/g,'<br>'); this.textarea = this.$refs.myTextarea.innerText.replace(/\n/g, '<br>');
this.$emit('update:urlType',0); this.$emit('update:urlType', 0);
this.$emit('update:jumpUrlInfo',{name:'',url:''}); this.$emit('update:jumpUrlInfo', { name: '', url: '' });
this.$emit('update:value',this.textarea); this.$emit('update:value', this.textarea);
}, },
computedTextLength() { computedTextLength() {
// this.textarea = this.$refs.myTextarea.innerHTML; // this.textarea = this.$refs.myTextarea.innerHTML;
return new Promise((resolve,reject) => { return new Promise((resolve, reject) => {
var textContent = strLength.getByteVal2(this.$refs.myTextarea.innerText); var textContent = strLength.getByteVal2(this.$refs.myTextarea.innerText);
var textNum = strLength.getZhLen(textContent); var textNum = strLength.getZhLen(textContent);
console.log(textNum); console.log(textNum);
if(textNum >= 300){ if (textNum >= 300) {
this.$message.error('最多300个字符哦'); this.$message.error('最多300个字符哦');
resolve(false); resolve(false);
} else { } else {
...@@ -172,11 +183,11 @@ export default { ...@@ -172,11 +183,11 @@ export default {
}); });
} }
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.wx-text{ .wx-text {
height: 200px; height: 200px;
width: 600px; width: 600px;
border: 1px solid #e7e7eb; border: 1px solid #e7e7eb;
...@@ -185,25 +196,22 @@ export default { ...@@ -185,25 +196,22 @@ export default {
height: 160px; height: 160px;
width: 600px; width: 600px;
& > div { & > div {
padding:10px; padding: 10px;
height: 140px; height: 140px;
width: 580px; width: 580px;
overflow-x: hidden; overflow-x: hidden;
outline:0; outline: 0;
} }
} }
&__opt { &__opt {
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
padding:0 20px; padding: 0 20px;
border-top:1px solid #e7e7eb; border-top: 1px solid #e7e7eb;
& > a { & > a {
padding-right: 10px; padding-right: 10px;
cursor: pointer; cursor: pointer;
} }
} }
} }
</style> </style>
module.exports = [ module.exports = [
{number:'{1}',name:'{姓名}'}, { number: '{1}', name: '{姓名}' },
{number:'{2}',name:'{姓名+先生/女士}'}, { number: '{2}', name: '{姓名+先生/女士}' },
{number:'{3}',name:'{生日日期}'}, { number: '{3}', name: '{生日日期}' },
{number:'{4}',name:'{生日天数}'}, { number: '{4}', name: '{生日天数}' },
{number:'{5}',name:'{关注日期}'}, { number: '{5}', name: '{关注日期}' },
{number:'{6}',name:'{关注天数}'}, { number: '{6}', name: '{关注天数}' },
{number:'{7}',name:'{主门店品牌名称}'}, { number: '{7}', name: '{主门店品牌名称}' },
{number:'{8}',name:'{主门店名称}'}, { number: '{8}', name: '{主门店名称}' },
{number:'{9}',name:'{主门店电话}'}, { number: '{9}', name: '{主门店电话}' },
{number:'{10}',name:'{专属导购姓名}'}, { number: '{10}', name: '{专属导购姓名}' },
{number:'{11}',name:'{专属导购手机号}'}, { number: '{11}', name: '{专属导购手机号}' },
{number:'{12}',name:'{开卡日期}'}, { number: '{12}', name: '{开卡日期}' },
{number:'{13}',name:'{开卡天数}'}, { number: '{13}', name: '{开卡天数}' },
{number:'{14}',name:'{开卡门店名称}'}, { number: '{14}', name: '{开卡门店名称}' },
{number:'{15}',name:'{会员卡号}'}, { number: '{15}', name: '{会员卡号}' },
{number:'{16}',name:'{会员等级名称}'}, { number: '{16}', name: '{会员等级名称}' },
{number:'{17}',name:'{主门店地址}'}, { number: '{17}', name: '{主门店地址}' },
{number:'{18}',name:'{会员等级剩余有效天数}'}, { number: '{18}', name: '{会员等级剩余有效天数}' },
{number:'{19}',name:'{积分余额}'}, { number: '{19}', name: '{积分余额}' },
{number:'{20}',name:'{30天内将过期积分额度}'}, { number: '{20}', name: '{30天内将过期积分额度}' },
{number:'{21}',name:'{储值余额}'}, { number: '{21}', name: '{储值余额}' },
{number:'{22}',name:'{消费总额}'}, { number: '{22}', name: '{消费总额}' },
{number:'{23}',name:'{消费次数}'}, { number: '{23}', name: '{消费次数}' },
{number:'{24}',name:'{最近消费日期}'}, { number: '{24}', name: '{最近消费日期}' },
{number:'{25}',name:'{最近消费间隔}'}, { number: '{25}', name: '{最近消费间隔}' },
{number:'{26}',name:'{最高单笔消费}'}, { number: '{26}', name: '{最高单笔消费}' },
{number:'{27}',name:'{最近消费门店名称}'}, { number: '{27}', name: '{最近消费门店名称}' },
{number:'{28}',name:'{最近消费品牌名称}'}] { number: '{28}', name: '{最近消费品牌名称}' }
];
const config = { const config = {
development: { development: {
// api: '/dmApi/' // api: '/dmApi/'
api:'http://gicdev.demogic.com/' api: 'http://gicdev.demogic.com/'
}, },
production: { production: {
// api: 'https://hope.demogic.com/', // api: 'https://hope.demogic.com/',
api: (window.location.protocol + '//' + window.location.host +'/') || '' api: window.location.protocol + '//' + window.location.host + '/' || ''
} }
} };
export default { export default {
api: config[process.env['NODE_ENV']]['api'] api: config[process.env['NODE_ENV']]['api']
} };
export default axios export default axios;
\ No newline at end of file
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
*/ */
export default { export default {
bind(el,binding,vnode,oldVnode) { bind(el, binding, vnode, oldVnode) {
let val = ''; let val = '';
el.addEventListener('click', function() { el.addEventListener('click', function() {
val = binding.value; val = binding.value;
const input = document.createElement('input'); const input = document.createElement('input');
el.appendChild(input) el.appendChild(input);
input.value = val; input.value = val;
input.select(); input.select();
document.execCommand("Copy"); document.execCommand('Copy');
el.__vue__.$tips({type:'success',message:'复制链接成功'}) el.__vue__.$tips({ type: 'success', message: '复制链接成功' });
input.parentNode.removeChild(input); input.parentNode.removeChild(input);
}) });
} }
} };
import axios from 'axios'; import axios from 'axios';
import config from '@/config' import config from '@/config';
const maxSize = 2 * 1024 * 1024; //5M const maxSize = 2 * 1024 * 1024; //5M
axios.defaults.withCredentials = true axios.defaults.withCredentials = true;
export default { export default {
inserted(el, binding) { inserted(el, binding) {
el.addEventListener("change", function() { el.addEventListener('change', function() {
if (el.files[0].size > maxSize) { if (el.files[0].size > maxSize) {
binding.value.$tips({ type: 'warning', message: '上传图片不能大于2M' }); binding.value.$tips({ type: 'warning', message: '上传图片不能大于2M' });
return; return;
} }
binding.value.upLoadDisabled = true; binding.value.upLoadDisabled = true;
let formData = new FormData(); let formData = new FormData();
formData.append('file', el.files[0]); formData.append('file', el.files[0]);
formData.append('requestProject', 'gic-web'); formData.append('requestProject', 'gic-web');
formData.append('wechatImageGroupId', binding.value.listParams.wechatImageGroupId || 1); formData.append('wechatImageGroupId', binding.value.listParams.wechatImageGroupId || 1);
axios.post(config.api + '/api-marketing/marketing-wechat-image-save', formData) axios
.then(res => { .post(config.api + '/api-marketing/marketing-wechat-image-save', formData)
if (res.data.errorCode === 0) { .then(res => {
binding.value.$tips({ type: 'success', message: '上传成功' }); if (res.data.errorCode === 0) {
binding.value.loadImgList(); binding.value.$tips({ type: 'success', message: '上传成功' });
} else { binding.value.loadImgList();
binding.value.$tips({ type: 'error', message:res.data.message || '上传失败' }); } else {
} binding.value.$tips({ type: 'error', message: res.data.message || '上传失败' });
binding.value.upLoadDisabled = false; }
}) binding.value.upLoadDisabled = false;
.catch(error => { })
binding.value.upLoadDisabled = false; .catch(error => {
binding.value.$tips({ type: 'error', message: error.msg || '上传失败' }); binding.value.upLoadDisabled = false;
}); binding.value.$tips({ type: 'error', message: error.msg || '上传失败' });
}); });
} });
} }
};
import clipboard from './clipboard' import clipboard from './clipboard';
import upload from './upload' import upload from './upload';
import imglibupload from './img-lib.js' import imglibupload from './img-lib.js';
export default { export default {
clipboard, clipboard,
upload, upload,
imglibupload imglibupload
} };
...@@ -3,47 +3,47 @@ ...@@ -3,47 +3,47 @@
*/ */
import axios from 'axios'; import axios from 'axios';
import config from '@/config' import config from '@/config';
const maxSize = 2 * 1024 * 1024; //5M const maxSize = 2 * 1024 * 1024; //5M
axios.defaults.withCredentials = true axios.defaults.withCredentials = true;
export default { export default {
inserted: function(el, binding) { inserted: function(el, binding) {
el.addEventListener("change", function() { el.addEventListener('change', function() {
binding.value.loading = true binding.value.loading = true;
if (el.files[0].size > maxSize) { if (el.files[0].size > maxSize) {
binding.value.$tips({ type: 'warning', message: '上传图片不能大于2M' }); binding.value.$tips({ type: 'warning', message: '上传图片不能大于2M' });
return; return;
}
binding.value.disabled = true;
let formData = new FormData();
formData.append(binding.value.fileType, el.files[0]);
formData.append('requestProject', 'gic-web');
axios
.post(config.api + binding.value.url, formData)
.then(res => {
console.log(res);
binding.value.loading = false;
el.value = '';
if (res.data.errorCode === 0) {
if (binding.value.url === '/api-plug/upload-img') {
(binding.value.model.code = res.data.result[0].imageFiledCode), (binding.value.model.imgUrl = res.data.result[0].qcloudImageUrl);
} else {
(binding.value.model.code = res.data.result.imageFiledCode), (binding.value.model.imgUrl = res.data.result.qcloudImageUrl);
binding.value.model.mediaId = res.data.result.imageMediaId;
binding.value.model.wxImg = res.data.result.wxImg || res.data.result.imageUrl || '';
} }
binding.value.disabled = true; binding.value.$tips({ type: 'success', message: '上传成功' });
let formData = new FormData(); } else {
formData.append(binding.value.fileType, el.files[0]); binding.value.$tips({ type: 'error', message: res.data.message || '上传失败' });
formData.append('requestProject', 'gic-web'); }
axios.post(config.api + binding.value.url, formData) binding.value.disabled = false;
.then(res => { })
console.log(res) .catch(error => {
binding.value.loading = false; binding.value.loading = false;
el.value = ""; binding.value.disabled = false;
if (res.data.errorCode === 0) { binding.value.$tips({ type: 'error', message: error.msg || '上传失败' });
if (binding.value.url === '/api-plug/upload-img') {
binding.value.model.code = res.data.result[0].imageFiledCode,
binding.value.model.imgUrl = res.data.result[0].qcloudImageUrl
} else {
binding.value.model.code = res.data.result.imageFiledCode,
binding.value.model.imgUrl = res.data.result.qcloudImageUrl
binding.value.model.mediaId = res.data.result.imageMediaId
binding.value.model.wxImg = res.data.result.wxImg || res.data.result.imageUrl || ''
}
binding.value.$tips({ type: 'success', message: '上传成功' });
} else {
binding.value.$tips({ type: 'error', message:res.data.message || '上传失败' });
}
binding.value.disabled = false;
}).catch(error => {
binding.value.loading = false;
binding.value.disabled = false;
binding.value.$tips({ type: 'error', message: error.msg || '上传失败' });
});
}); });
} });
} }
};
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import App from './App'; import App from './App';
import router from './router'; import router from './router';
import store from './store'; import store from './store';
import {axios} from './service/api/index'; import { axios } from './service/api/index';
import directives from './directives'; import directives from './directives';
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import vueGicHeader from '@gic-test/vue-gic-header'; import vueGicHeader from '@gic-test/vue-gic-header';
...@@ -12,13 +12,14 @@ import vueGicCard from '@gic-test/vue-gic-card'; ...@@ -12,13 +12,14 @@ import vueGicCard from '@gic-test/vue-gic-card';
import vueGicStore from '@gic-test/vue-gic-store'; import vueGicStore from '@gic-test/vue-gic-store';
import vueGicStoreLinkage from '@gic-test/vue-gic-store-linkage/src/lib'; import vueGicStoreLinkage from '@gic-test/vue-gic-store-linkage/src/lib';
import vueGicStoreGroup from '@gic-test/vue-gic-store-group'; import vueGicStoreGroup from '@gic-test/vue-gic-store-group';
import vueGicPeople from '@gic-test/vue-gic-people'; import vueGicPeople from '@gic-test/vue-gic-people/src/lib';
import vueGicConfirmPeople from '@gic-test/vue-gic-confirm-people/src/lib'; import vueGicConfirmPeople from '@gic-test/vue-gic-confirm-people/src/lib';
import vueGicImgPreview from '@gic-test/vue-gic-img-preview'; import vueGicImgPreview from '@gic-test/vue-gic-img-preview';
import vueGicMemberGroup from '@gic-test/vue-gic-member-group/src/lib' import vueGicMemberGroup from '@gic-test/vue-gic-member-group/src/lib';
import { gicStoreCard } from '@gic-test/vue-gic-store-new'; import { gicStoreCard } from '@gic-test/vue-gic-store-new';
import packele from 'packele'; import packele from 'packele';
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(packele); Vue.use(packele);
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.use(vueGicHeader); Vue.use(vueGicHeader);
...@@ -38,12 +39,18 @@ Vue.prototype.axios.withCredentials = true; ...@@ -38,12 +39,18 @@ Vue.prototype.axios.withCredentials = true;
Object.keys(directives).map(item => Vue.directive(item, directives[item])); Object.keys(directives).map(item => Vue.directive(item, directives[item]));
window.$bus = new Vue(); window.$bus = new Vue();
let flag = false; let flag = false;
Vue.prototype.$tips = function ({message = '提示',type = 'success'}) { Vue.prototype.$tips = function({ message = '提示', type = 'success' }) {
if (flag) { return } if (flag) {
else {this.$message({message,type})} return;
} else {
this.$message({ message, type });
}
flag = true; flag = true;
setTimeout(_ => {flag = false},1000); setTimeout(_ => {
} flag = false;
}, 1000);
};
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({
el: '#app', el: '#app',
......
export default { export default {
data() { data() {
return { return {
defaultAvatar:require('../assets/img/head_default.png'), defaultAvatar: require('../assets/img/head_default.png')
} };
}, },
methods: { methods: {
filterAvatar(img) { filterAvatar(img) {
return img?img.replace(/^http(s)?/,'https'):this.defaultAvatar; return img ? img.replace(/^http(s)?/, 'https') : this.defaultAvatar;
} }
} }
} };
import Vue from 'vue' import Vue from 'vue';
export default { export default {
methods: { methods: {
nonnegative(val){ nonnegative(val) {
if (val<0) { if (val < 0) {
val = 0; val = 0;
this.$tips({type:'warning',message:'不能为负值'}) this.$tips({ type: 'warning', message: '不能为负值' });
} }
} }
} }
} };
...@@ -4,18 +4,18 @@ ...@@ -4,18 +4,18 @@
// 分页 // 分页
// //
export default { export default {
methods:{ methods: {
refresh() { refresh() {
this.listParams.currentPage = 1; this.listParams.currentPage = 1;
this.getTableList(); this.getTableList();
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.listParams.pageSize = val; this.listParams.pageSize = val;
this.getTableList(); this.getTableList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.listParams.currentPage = val; this.listParams.currentPage = val;
this.getTableList(); this.getTableList();
} }
} }
} };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment