Commit 1e029fb9 by zhangmeng

chore:修改了结构

fix:修改了卡券图文禁止修改的问题
parent c60972d1
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
es6: true
browser: true
},
extends: [
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
// 'standard',
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
// "standard",
'plugin:vue/essential',
"plugin:prettier/recommended",
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'plugin:prettier/recommended'
],
// required to lint *.vue files
plugins: [
'vue'
],
plugins: ['vue', 'prettier'],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
'prettier/prettier': [
'error',
{
endOfLine: 'auto'
}
],
"no-console": process.env.NODE_ENV === "production" ? 2 : 0,
"no-alert": process.env.NODE_ENV === "production" ? 2 : 0, //禁止使用alert confirm prompt
"no-debugger": process.env.NODE_ENV === "production" ? 2 : 0,
// allow async-await
'generator-star-spacing': 'off',
'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-alert': process.env.NODE_ENV === 'production' ? 2 : 0, //禁止使用alert confirm prompt
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// --------------------静态检测-----------------------------
/**
* 静态检测:
......@@ -41,10 +40,10 @@ module.exports = {
'no-compare-neg-zero': 2,
// 禁止将常量作为 if 或三元表达式的测试条件,比如 if (true), let foo = 0 ? 'foo' : 'bar'
'no-constant-condition': [
2,
{
checkLoops: false
}
2,
{
checkLoops: false
}
],
// 禁止在函数参数中出现重复名称的参数 【辅助检测】
'no-dupe-args': 2,
......@@ -52,10 +51,10 @@ module.exports = {
'no-dupe-keys': 2,
// 禁止出现空代码块 【可读性差】
'no-empty': [
2,
{
allowEmptyCatch: true
}
2,
{
allowEmptyCatch: true
}
],
// 禁止将 catch 的第一个参数 error 重新赋值 【重新赋值,error将没有意义】
'no-ex-assign': 2,
......@@ -69,13 +68,13 @@ module.exports = {
'no-inner-declarations': [2, 'both'],
// 禁止使用特殊空白符(比如全角空格),除非是出现在字符串、正则表达式或模版字符串中
'no-irregular-whitespace': [
2,
{
skipStrings: true,
skipComments: false,
skipRegExps: true,
skipTemplates: true
}
2,
{
skipStrings: true,
skipComments: false,
skipRegExps: true,
skipTemplates: true
}
],
// typeof 表达式比较的对象必须是 'undefined', 'object', 'boolean', 'number', 'string', 'function' 或 'symbol'
'valid-typeof': 2,
......@@ -85,21 +84,18 @@ module.exports = {
* 这些规则通过一些最佳实践帮助你避免问题
*/
// 禁止函数的循环复杂度超过 20,【https://en.wikipedia.org/wiki/Cyclomatic_complexity】
'complexity': [
2,
{
max: 20
}
complexity: [
2,
{
max: 20
}
],
// 不允许有空函数,除非是将一个空函数设置为某个项的默认值 【否则空函数并没有实际意义】
'no-empty-function': [
2,
{
allow: [
'functions',
'arrowFunctions'
]
}
2,
{
allow: ['functions', 'arrowFunctions']
}
],
// 禁止修改原生对象 【例如 Array.protype.xxx=funcion(){},很容易出问题,比如for in 循环数组 会出问题】
'no-extend-native': 2,
......@@ -115,39 +111,39 @@ module.exports = {
'no-self-compare': 2,
// @fixable 立即执行的函数必须符合如下格式 (function () { alert('Hello') })() 【立即函数写法很多,这个是最易读最标准的】
'wrap-iife': [
2,
'inside',
{
functionPrototypeMethods: true
}
2,
'inside',
{
functionPrototypeMethods: true
}
],
// 禁止使用保留字作为变量名 [规则帮助检测保留字,通常ide难以发现,生产会出现问题]
'no-shadow-restricted-names': 2,
// 禁止使用未定义的变量
'no-undef': [
2,
{
typeof: false
}
2,
{
typeof: false
}
],
// 定义过的变量必须使用 【正规应该是这样的,具体可以大家讨论】
'no-unused-vars': [
2,
{
vars: 'all',
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true
}
2,
{
vars: 'all',
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true
}
],
// 变量必须先定义后使用 【ps:涉及到es6存在不允许变量提升的问题,以免引起意想不到的错误,具体可以大家讨论】
'no-use-before-define': [
2,
{
functions: false,
classes: false,
variables: false
}
2,
{
functions: false,
classes: false,
variables: false
}
],
// ----------------------------------------------------代码规范----------------------------------------------------------
/**
......@@ -156,12 +152,12 @@ module.exports = {
* */
// 变量名必须是 camelcase 驼峰风格的
// @off 【涉及到 很多 api 或文件名可能都不是 camelcase 先关闭】
'camelcase': 0,
camelcase: 0,
// @fixable 禁止在行首写逗号
'comma-style': [2, 'last'],
// @fixable 一个缩进必须用两个空格替代
// @off 【不限制大家,为了关闭eslint默认值,所以手动关闭,off不可去掉】 讨论
'indent': [2, 2],
indent: [2, 2, { SwitchCase: 1 }],
//@off 手动关闭//前面需要回车的规则 注释
'spaced-comment': 0,
//@off 手动关闭: 禁用行尾空白
......@@ -175,21 +171,21 @@ module.exports = {
// @fixable 结尾禁止使用分号
//@off [vue官方推荐无分号,不知道大家是否可以接受?先手动off掉] 讨论
// "semi": [2,"never"],
"semi": 2,
semi: 0,
// 代码块嵌套的深度禁止超过 5 层
'max-depth': [1, 5],
// 回调函数嵌套禁止超过 4 层,多了请用 async await 替代
'max-nested-callbacks': [2, 4],
'max-depth': [1, 10],
// 回调函数嵌套禁止超过 5 层,多了请用 async await 替代
'max-nested-callbacks': [2, 5],
// 函数的参数禁止超过 7 个
'max-params': [2, 7],
// new 后面的类名必须首字母大写 【面向对象编程原则】
'new-cap': [
2,
{
newIsCap: true,
capIsNew: false,
properties: true
}
2,
{
newIsCap: true,
capIsNew: false,
properties: true
}
],
// @fixable new 后面的类必须有小括号 【没有小括号、指针指过去没有意义】
'new-parens': 2,
......@@ -202,9 +198,9 @@ module.exports = {
// @fixable 【变量申明必须每行一个,同上】
'one-var-declaration-per-line': [2, 'always'],
//是否使用全等
'eqeqeq': 0,
eqeqeq: 0,
//this别名
'consistent-this': [2, "that"],
'consistent-this': [2, 'that'],
// -----------------------------ECMAScript 6-------------------------------------
/**
* ECMAScript 6
......@@ -224,16 +220,16 @@ module.exports = {
'no-var': 0,
// ---------------------------------被关闭的规则-----------------------
// parseInt必须指定第二个参数 parseInt("071",10);
'radix': 0,
radix: 0,
//强制使用一致的反勾号、双引号或单引号 (quotes) 关闭
'quotes': 0,
quotes: 0,
//要求或禁止函数圆括号之前有一个空格
'space-before-function-paren': [0, "always"],
'space-before-function-paren': [0, 'always'],
//禁止或强制圆括号内的空格
'space-in-parens': [0, "never"],
'space-in-parens': [0, 'never'],
//关键字后面是否要空一格
"space-after-keywords": [0, "always"],
'space-after-keywords': [0, 'always'],
// 要求或禁止在函数标识符和其调用之间有空格
"func-call-spacing": [0, "never"]
'func-call-spacing': [0, 'never']
}
}
};
......@@ -10,15 +10,15 @@ function resolve (dir) {
const createLintingRule = () => ({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
loader: "eslint-loader",
enforce: "pre",
include: [resolve("src"), resolve("test")],
options: {
fix: true
// formatter: require('eslint-friendly-formatter'),
// emitWarning: !config.dev.showEslintErrorsInOverlay
// fix: true,
formatter: require("eslint-friendly-formatter"),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
})
});
module.exports = {
context: path.resolve(__dirname, '../'),
......
<!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.b29a8a61b591c9bf360de6dcf8f4f777.css rel=stylesheet></head><body><div id=app></div><script src=http://web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=http://web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=http://web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=http://web-1251519181.file.myqcloud.com/lib/elementUI/index.2.5.4.js></script><script src=http://web-1251519181.file.myqcloud.com/components/header.2.0.00.js></script><script src=http://web-1251519181.file.myqcloud.com/components/footer.2.0.02.js></script><script src=http://web-1251519181.file.myqcloud.com/components/card.2.0.00.js></script><script src=http://web-1251519181.file.myqcloud.com/components/store.2.0.00.js></script><script src=http://web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script src=http://web-1251519181.file.myqcloud.com/components/member-group.2.0.00.js></script><script src=http://web-1251519181.file.myqcloud.com/components/store-card.2.0.00.js></script><script src=http://web-1251519181.file.myqcloud.com/components/confirm-people.2.0.00.js></script><script src=http://web-1251519181.file.myqcloud.com/components/people.2.0.00.js></script><script type=text/javascript src=/marketing/static/js/manifest.0a85049e489e85ac5f0a.js></script><script type=text/javascript src=/marketing/static/js/vendor.195599a21f32417e94aa.js></script><script type=text/javascript src=/marketing/static/js/app.2876fb009a610643e260.js></script></body></html>
\ No newline at end of file
<!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.8a5600ccec4e19af9b2ed627860e8c91.css rel=stylesheet></head><body><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/elementUI/index.2.5.4.js></script><script src=//web-1251519181.file.myqcloud.com/components/header.2.0.03.js></script><script src=//web-1251519181.file.myqcloud.com/components/footer.2.0.02.js></script><script src=//web-1251519181.file.myqcloud.com/components/card.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/store.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/member-group.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/store-card.2.0.00.js></script><script src=//web-1251519181.file.myqcloud.com/components/confirm-people.2.0.00.js></script><script type=text/javascript src=/marketing/static/js/manifest.0a85049e489e85ac5f0a.js></script><script type=text/javascript src=/marketing/static/js/vendor.b95f77e8a57f632ca3ef.js></script><script type=text/javascript src=/marketing/static/js/app.04d34e5a24d1dc8ba8cc.js></script></body></html>
\ 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.
......@@ -14,20 +14,19 @@
<div id="app"></div>
<!-- built files will be auto injected -->
<!-- 库引用cdn -->
<script src="http://web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js"></script>
<!-- <script src="http://web-1251519181.file.myqcloud.com/lib/axios/index.0.19.0-beta.1.js"></script> -->
<script src="http://web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/lib/elementUI/index.2.5.4.js"></script>
<script src="//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js"></script>
<script src="//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js"></script>
<script src="//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js"></script>
<script src="//web-1251519181.file.myqcloud.com/lib/elementUI/index.2.5.4.js"></script>
<!-- 组件引用cdn -->
<script src="http://web-1251519181.file.myqcloud.com/components/header.2.0.00.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/components/footer.2.0.02.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/components/card.2.0.00.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/components/store.2.0.00.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/components/member-group.2.0.00.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/components/store-card.2.0.00.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/components/confirm-people.2.0.00.js"></script>
<script src="http://web-1251519181.file.myqcloud.com/components/people.2.0.00.js"></script>
<script src="//web-1251519181.file.myqcloud.com/components/header.2.0.03.js"></script>
<script src="//web-1251519181.file.myqcloud.com/components/footer.2.0.02.js"></script>
<script src="//web-1251519181.file.myqcloud.com/components/card.2.0.00.js"></script>
<script src="//web-1251519181.file.myqcloud.com/components/store.2.0.00.js"></script>
<script src="//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js"></script>
<script src="//web-1251519181.file.myqcloud.com/components/member-group.2.0.00.js"></script>
<script src="//web-1251519181.file.myqcloud.com/components/store-card.2.0.00.js"></script>
<script src="//web-1251519181.file.myqcloud.com/components/confirm-people.2.0.00.js"></script>
<!-- <script src="http://web-1251519181.file.myqcloud.com/components/people.2.0.00.js"></script> -->
</body>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,23 +8,11 @@
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js",
"format": "onchange 'test/**/*.js' 'src/**/*.js' 'src/**/*.vue' -- prettier --write {{changed}}",
"publish": "publish.bat"
"format": "onchange 'test/**/*.js' 'src/**/*.js' 'src/**/*.vue' -- prettier --write {{changed}}"
},
"dependencies": {
"@antv/data-set": "^0.8.9",
"@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.4.2",
"@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.81",
"@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.3.3",
"@riophae/vue-treeselect": "^0.0.36",
"@tinymce/tinymce-vue": "^1.0.8",
"axios": "^0.18.0",
......@@ -36,9 +24,7 @@
"uuid": "^3.3.2",
"v-charts": "^1.17.8",
"viser-vue": "^2.2.5",
"vue": "^2.5.2",
"vue-axios": "^2.1.1",
"vue-photo-preview": "^1.0.9",
"vue-qr": "^1.3.8",
"vue-router": "^3.0.1",
"vue-ueditor-wrap": "^1.3.4",
......@@ -65,6 +51,7 @@
"css-loader": "^0.28.0",
"element-theme-chalk": "^2.4.1",
"eslint": "^5.6.0",
"eslint-config-prettier": "^4.0.0",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.1.1",
......@@ -89,6 +76,7 @@
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"prettier": "^1.16.4",
"rimraf": "^2.6.0",
"sass-loader": "^7.0.3",
"semver": "^5.3.0",
......
......@@ -34,33 +34,33 @@
<script>
// import { getRequest } from './api';
import qs from "qs";
import qs from 'qs';
export default {
name: "vue-gic-aside-menu",
props: ["collapseFlag", "projectName"], //'leftMenuRouter','leftModulesName',
name: 'vue-gic-aside-menu',
props: ['collapseFlag', 'projectName'], //'leftMenuRouter','leftModulesName',
data() {
return {
repProjectName: "gic-web", // 项目名
repProjectName: 'gic-web', // 项目名
// 高度
asideHeight: "0px",
pathName: "", // 路由名
asideHeight: '0px',
pathName: '', // 路由名
leftCollapse: false, // 是否收起左侧
leftModuleName: "",
leftModuleName: '',
// defaultSub: ['1','2','3','4','5','6','7','8','9'], // 默认打开子菜单
menuLeftRouter: [],
// 获取 location origin
baseUrl: "",
baseUrl: '',
//已选菜单
selectMenu: ""
selectMenu: ''
};
},
beforeMount() {
var that = this;
var host = window.location.origin;
// console.log("当前host:",host)
if (host.indexOf("localhost") != "-1") {
that.baseUrl = "http://gicdev.demogic.com";
if (host.indexOf('localhost') != '-1') {
that.baseUrl = 'http://gicdev.demogic.com';
} else {
that.baseUrl = host;
}
......@@ -85,11 +85,11 @@ export default {
newData.forEach(function(ele, index) {
if (ele.level4List == null || ele.level4List.length == 0) {
// 设置 url
ele.menuUrl = "/" + ele.menuUrl;
ele.menuUrl = '/' + ele.menuUrl;
} else {
ele.level4List.forEach(function(el, key) {
// 设置 url
el.menuUrl = "/" + el.menuUrl;
el.menuUrl = '/' + el.menuUrl;
});
}
});
......@@ -113,19 +113,19 @@ export default {
// 触发父组件路由
toRouter(path) {
var that = this;
that.$emit("toLeftRouterView", "/" + path);
that.$emit('toLeftRouterView', '/' + path);
},
// 刷新路由
refreshRoute() {
var that = this;
//获取项目名 pathname (路由的hash)
that.routePathName = window.location.hash.split("/")[1];
if (that.routePathName.indexOf("?") != -1) {
that.routePathName = that.routePathName.split("?")[0];
that.routePathName = window.location.hash.split('/')[1];
if (that.routePathName.indexOf('?') != -1) {
that.routePathName = that.routePathName.split('?')[0];
}
if (that.routePathName.indexOf("/") != -1) {
that.routePathName = that.routePathName.split("/")[0];
if (that.routePathName.indexOf('/') != -1) {
that.routePathName = that.routePathName.split('/')[0];
}
// console.log("routePathname:",that.routePathName)
that.pathName = that.routePathName;
......@@ -142,7 +142,7 @@ export default {
};
that.axios
.post(that.baseUrl + "/api-auth/get-current-memu-data", qs.stringify(para))
.post(that.baseUrl + '/api-auth/get-current-memu-data', qs.stringify(para))
.then(res => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data;
......@@ -159,12 +159,12 @@ export default {
}
if (!!resData.result.level4) {
// 设置选中menu
that.selectMenu = "/" + resData.result.level4.menuUrl;
that.selectMenu = '/' + resData.result.level4.menuUrl;
return;
}
if (!!resData.result.level3) {
// 设置选中menu
that.selectMenu = "/" + resData.result.level3.menuUrl;
that.selectMenu = '/' + resData.result.level3.menuUrl;
}
// sessionStorage.setItem('activeHead',resData.result.level2.menuCode)
......@@ -200,7 +200,7 @@ export default {
projectName: function(newData, oldData) {
var that = this;
// console.log("新数据:",newData,oldData)
that.repProjectName = newData || "gic-web";
that.repProjectName = newData || 'gic-web';
}
},
......@@ -210,15 +210,15 @@ export default {
var that = this;
// 项目名
that.repProjectName = that.projectName || "gic-web";
that.repProjectName = that.projectName || 'gic-web';
// 获取高度
that.asideHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 64 + "px";
that.asideHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 64 + 'px';
//获取项目名 pathname (路由的hash)
that.pathName = window.location.hash.split("/")[1];
if (that.pathName.indexOf("?") != -1) {
that.pathName = that.pathName.split("?")[0];
that.pathName = window.location.hash.split('/')[1];
if (that.pathName.indexOf('?') != -1) {
that.pathName = that.pathName.split('?')[0];
}
// console.log("pathname:",that.pathName)
......@@ -413,7 +413,7 @@ export default {
}
.leftBar-wrap .el-submenu .el-menu-item::before {
position: absolute;
content: "●";
content: '●';
left: 35px;
top: 0px;
font-size: 10px;
......
......@@ -55,9 +55,9 @@ import qs from 'qs';
* 清除重复
*/
function uniqueByType(arr, type) {
var res = [];
var json = {};
for (var i = 0; i < arr.length; i++) {
let res = [];
let json = {};
for (let i = 0; i < arr.length; i++) {
if (!json[arr[i][type]]) {
res.push(arr[i]);
json[arr[i][type]] = 1;
......@@ -90,7 +90,7 @@ export default {
rightList: [],
leftSelected: [],
rightSelected: [],
avatar: require('../../assets/img/head_default.png')
avatar: () => import('../../assets/img/head_default.png')
};
},
watch: {
......
<template>
<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 class="user-header-pop" style="z-index: 1999;" :projectName="projectName" :collapseFlag="collapseFlag" @collapseTag="collapseTagHandler" @toRouterView="toRouterView"></vue-gic-header>
<div class="layout">
<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 }]">
......@@ -19,18 +19,13 @@
<router-view></router-view>
</div>
</div>
<vue-gic-footer></vue-gic-footer>
</div>
</div>
</div>
</template>
<script>
import vueGicHeader from '@gic-test/vue-gic-header/src/lib/vue-gic-header.vue';
export default {
components: {
'vue-gic-header-test': vueGicHeader
},
data() {
return {
collapseFlag: false,
......
......@@ -61,7 +61,7 @@ export default {
this.$emit('moveSingleImg', this.imgData.imageId);
},
async updateImgName(val) {
let res = await updateImgName({ imageId: this.imgData.imageId, imageTitle: val });
await updateImgName({ imageId: this.imgData.imageId, imageTitle: val });
this.$tips({ type: 'success', message: '修改成功' });
this.$emit('refresh');
}
......
......@@ -152,7 +152,7 @@ export default {
});
},
async addGroupService(val) {
let res = await addGroupService({ groupName: val });
await addGroupService({ groupName: val });
this.$tips({ type: 'success', message: '新增成功' });
this.loadImgList();
}
......
......@@ -148,7 +148,7 @@ export default {
},
async changeGroupService(wechatImageGroupId, imageId) {
try {
let res = await changeGroupService({ imageId: imageId, wechatImageGroupId: wechatImageGroupId });
await changeGroupService({ imageId: imageId, wechatImageGroupId: wechatImageGroupId });
this.$tips({ type: 'success', message: '移动分组成功' });
this.moveImgVal = '';
this.checkedList = [];
......@@ -181,7 +181,7 @@ export default {
},
async deleteImageService(val) {
try {
let res = await deleteImageService({ imageIds: val });
await deleteImageService({ imageIds: val });
this.$tips({ type: 'success', message: '删除图片成功' });
this.loadImgList();
} catch (err) {
......@@ -204,7 +204,7 @@ export default {
},
async deleteGroupService() {
try {
let res = await deleteGroupService({ wechatImageGroupId: this.listParams.wechatImageGroupId });
await deleteGroupService({ wechatImageGroupId: this.listParams.wechatImageGroupId });
this.$tips({ type: 'success', message: '删除分组成功!' });
this.listParams.wechatImageGroupId = '';
this.loadImgList();
......@@ -232,7 +232,7 @@ export default {
});
},
async addGroupService(val) {
let res = await addGroupService({ groupName: val });
await addGroupService({ groupName: val });
this.$tips({ type: 'success', message: '新增成功' });
this.loadImgList();
},
......@@ -257,7 +257,7 @@ export default {
});
},
async updateGroupName(val) {
let res = await updateGroupName({ wechatImageGroupId: this.listParams.wechatImageGroupId, groupName: val });
await updateGroupName({ wechatImageGroupId: this.listParams.wechatImageGroupId, groupName: val });
this.$tips({ type: 'success', message: '修改成功' });
this.loadImgList();
}
......
......@@ -18,7 +18,9 @@ export default {
},
dataList: {
type: Array,
default: []
default: () => {
return [];
}
}
},
data() {
......
export default {
api: process.env['NODE_ENV'] === 'development' ? 'http://gicdev.demogic.com/' :(window.location.protocol + '//' + window.location.host + '/' || '')
api: process.env['NODE_ENV'] === 'development' ? 'http://gicdev.demogic.com/' : window.location.protocol + '//' + window.location.host + '/' || ''
};
import Vue from 'vue';
import App from './App';
import router from './router';
import store from './store';
import { axios } from './service/api/index';
import directives from './directives';
import vueGicAsideMenu from '@/components/aside-menu';
import vueGicPeople from '@gic-test/vue-gic-people';
import packele from 'packele';
Vue.config.productionTip = false;
Vue.use(packele);
Vue.use(vueGicPeople);
Vue.use(vueGicAsideMenu);
Vue.prototype.axios = axios;
Vue.prototype.axios.withCredentials = true;
......@@ -26,7 +29,6 @@ Vue.prototype.$tips = function({ message = '提示', type = 'success' }) {
}, 1000);
};
/* eslint-disable no-new */
new Vue({
el: '#app',
......
......@@ -4,7 +4,7 @@ import page403 from '@/views/error/403';
import page404 from '@/views/error/404';
import page500 from '@/views/error/500';
import test from './modules/test'
// import test from './modules/test';
//微信营销
import wechat from './modules/wechat';
......@@ -54,6 +54,6 @@ export default [
path: '*',
name: '未知领域',
component: page404
},
}
// test
];
import { requests } from './index';
import router from '@/router';
const MARKET_PREFIX = 'api-marketing/';
const PLUG_PREFIX = 'api-plug/';
const GOODS_PREFIX = 'api-admin/';
import Vue from 'vue';
const _vm = new Vue();
//获取营销场景
export const sceneSettingList = params => requests(MARKET_PREFIX + 'scene-setting-list', params);
......
import { requests } from './index';
import router from '@/router';
const PREFIX = 'api-marketing/';
import config from '@/config';
......
import { requests } from './index';
import router from '@/router';
const PREFIX = 'api-marketing/';
import config from '@/config';
export const url = config.api + PREFIX;
......
import { requests } from './index';
import router from '@/router';
const PREFIX = 'api-marketing/';
import config from '@/config';
......
......@@ -17,13 +17,8 @@ let _requests = [];
axios.defaults.baseURL = _apiHost;
console.log(axios.defaults)
console.log(axios.defaults);
// 创建一个请求实例
// const axios = axios.create({
// baseURL: _apiHost,
// timeout: TIME_OUT_MAX,
// headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
// });
/**
* 添加请求,显示loading
* @param {请求配置} config
......
import { requests } from './index';
import router from '@/router';
const PREFIX = 'api-marketing/';
import config from '@/config';
export const url = config.api + PREFIX;
......
import { requests } from './index';
import router from '@/router';
const PREFIX = 'api-marketing/';
import config from '@/config';
export const url = config.api + PREFIX;
......
import { requests } from './index';
import router from '@/router';
const PREFIX = 'api-marketing/';
import Vue from 'vue';
const _vm = new Vue();
//发送记录
export const sendRecordList = params => requests(PREFIX + 'page-send-record', params);
......
export default {
name: 'TableExpand',
functional: true,
props: {
row: Object,
render: Function,
index: Number,
column: {
type: Object,
default: null
}
},
render: (h, ctx) => {
const params = {
row: ctx.props.row,
index: ctx.props.index
};
function countDown(i) {
if (i<=0) {
return i;
} else {
countDown(i-1);
}
console.log(i)
}
if (ctx.props.column) params.column = ctx.props.column;
return ctx.props.render(h, params);
}
};
<template>
<div>
<el-table :data="data">
<template v-for="(v,i) in columns">
<el-table-column
v-if="v.type === undefined"
:type="v.type"
:key="i"
:column-key="v.columnKey"
:index="v.index"
:label="v.label"
:prop="v.prop"
:width="v.width"
:min-width="v.minWidth"
:fixed="v.fixed"
:render-header="v.renderHeader"
:sortable="v.sortable"
:sort-method="v.sortMethod"
:sort-by="v.sortBy"
:sort-orders="v.sortOrders"
:resizable="v.resizable"
:formatter="v.formatter"
:show-overflow-tooltip="v.showOverflowTooltip"
:align="v.align"
:header-align="v.headerAlign"
:class-name="v.className"
:label-class-name="v.labelClassName"
:selectable="v.selectable"
:reserve-selection="v.reserveSelection"
:filters="v.filters"
:filter-placement="v.filterPlacement"
:filter-multiple="v.filterMultiple"
:filter-method="v.filterMethod"
:filtered-value="v.filteredValue">
<template slot-scope="scope">
<!-- 如果有filter -->
<Cell
v-if="v.render"
:row="scope.row"
:column="scope.column"
:index="scope.$index"
:render="v.render"></Cell>
<!-- <span v-if="v.filter">
{{Vue.filter(v[filter])(scope.row[v.prop])}}
</span>
<span v-else-if="v.formatter">
{{v.formatter(scope.row)}}
</span> -->
<span v-else>
{{scope.row[v.prop]}}
</span>
</template>
</el-table-column>
</template>
</el-table>
</div>
</template>
<script>
import { Table } from 'element-ui';
import Vue from 'vue';
import Cell from './expand';
export default {
name:'dm-table',
components:{
'el-table':Table,
Cell
// 'test-com':this.propComponents[0]
},
props:['columns','data','propComponents'],
created() {
},
methods:{
compile(template) {
// this.$nextTick(_ => {
// console.log(this,this.$parent)
// compile
// })
// const span = document.createElement('span');
// span.innerHTML = template;
// // console.log(this);
// const dom = this.compile(span); // 在父级上下文编译组件
// // return dom;
// this.$el.appendChild(dom); // 将编译后的html插入当前组件
}
}
}
</script>
# vue 插件—-门店选择组件
<<<<<<< HEAD
> A Vue.js Store New Plugin
## Install
```shell
npm install @gic-test/vue-gic-store-new -S
```
## how to use
```
// main.js
import dmStore from './dmStore';
import dmCard from './dmStore/store-card';
// 通用组件
import vueGicStoreNew from '@gic-test/vue-gic-store-new'
Vue.use(vueGicStoreLinkage)
// 卡券中使用
import { vueGicStoreCard } from '@gic-test/vue-gic-store-new'
Vue.use(vueGicStoreCard)
// 使用页面
<vue-gic-store-new :uuid="uuid"></vue-gic-store-new>
<vue-gic-store-card :uuid="uuid"></vue-gic-store-card>
data() {
return {
// 参数
uuid:'', // 新增传空,编辑必传
}
}
```
import axios from 'axios';
import qs from 'qs';
axios.defaults.timeout = 10000;
let base = "http://192.168.1.164:8282/gic/";
const timeout = 10000;
let token = ''//sessionStorage.getItem('user');
/*
*
* 统一 get 请求方法
* @url: 请求的 url
* @params: 请求带的参数
* @header: 带 token
*
*/
export const getRequest = (url, params) => {
return axios({
method: 'get',
url: `${base}${url}`,
data: {},
params: params,
headers: {'content-type': 'application/x-www-form-urlencoded'},// "token": token
});
}
const host = window.location.origin;
export const baseUrl = host.indexOf('localhost') !== -1 ? 'http://gicdev.demogic.com' : host
<template>
<section class="dm-store">
<el-select v-model="storeType" placeholder="请选择" class="w200 inline-block mr5">
<el-option v-for="(v,i) in leftList" :key="i" :label="v.label" :value="v.value"></el-option>
</el-select>
<option-type
v-if="storeType === 1"
:uuid="newUuid"
:cacheUuid="cacheUuid"
:isAdd="isAdd"
:isCache.sync="isSendCache"
></option-type>
<option-tags
v-if="storeType === 2"
:uuid="newUuid"
:cacheUuid="cacheUuid"
:isAdd="isAdd"
:isCache.sync="isSendCache"
></option-tags>
<option-area
v-if="storeType === 3"
:uuid="newUuid"
:cacheUuid="cacheUuid"
:isAdd="isAdd"
:isCache.sync="isSendCache"
></option-area>
<option-group
v-if="storeType === 4"
:uuid="newUuid"
:cacheUuid="cacheUuid"
:isAdd="isAdd"
:isCache.sync="isSendCache"
></option-group>
<option-part
v-if="storeType === 5"
:uuid="newUuid"
:cacheUuid="cacheUuid"
:isAdd="isAdd"
:isCache.sync="isSendCache"
></option-part>
</section>
</template>
<script>
import qs from "qs";
import uuidv1 from "uuid/v1";
import { baseUrl } from "./config";
import optionType from "./optionsGroup/option-type";
import optionArea from "./optionsGroup/option-area";
import optionTags from "./optionsGroup/option-tags";
import optionGroup from "./optionsGroup/option-group";
import optionPart from "./optionsGroup/option-part";
const leftList = [
{ label: "所有门店", value: 0 },
{ label: "门店类型", value: 1 },
{ label: "门店标签", value: 2 },
{ label: "门店区域", value: 3 },
{ label: "门店分组", value: 4 },
{ label: "部分门店", value: 5 }
];
const typeList = [
{ label: "自营", value: "0" },
{ label: "联营", value: "1" },
{ label: "代理", value: "2" },
{ label: "代销", value: "3" },
{ label: "托管", value: "4" }
];
export default {
name: "vue-gic-store-group",
props: {
uuid: {
type: String,
default: ""
},
options: {
type: Array,
default() {
return [0, 1, 2, 3, 4, 5];
}
},
isAdd: {
type: Boolean,
default: true
}
},
components: {
"option-type": optionType,
"option-area": optionArea,
"option-tags": optionTags,
"option-group": optionGroup,
"option-part": optionPart
},
watch: {
storeType(val) {
if (!val) {
this.$emit("update:uuid", this.cacheUuid);
this.isSendCache = true;
this.saveInit(this.isSendCache);
}
},
uuid(val) {
// 编辑或者详情
if (val && !this.isAdd) {
if (this.isSendCache) return;
this.init();
}
},
isSendCache(val) {
if (val) {
this.$emit("update:uuid", this.cacheUuid);
this.$nextTick(_ => {
console.log(this.uuid);
});
}
}
},
data() {
return {
storeType: 0, // 一级选择值
leftList: [],
// 创建一个新的uuid
newUuid: uuidv1().replace(/-/g, ""),
// 编辑情况下的备份id
cacheUuid: uuidv1().replace(/-/g, ""), // 生成uuid
// 编辑的情况下是否发送备份ID
isSendCache: false
};
},
created() {
if (this.options instanceof Array) {
leftList.map(v => {
if (this.options.indexOf(v.value) >= 0) {
this.leftList.push(v);
}
});
}
this.init();
},
methods: {
// 获取配置项
init() {
this.storeType = 0;
/*如果没有uuid的情况下
1 设置一个新的uuid
2 并传给父级
3 保存
*/
if (this.isAdd) {
this.$emit("update:uuid", this.newUuid);
// 这是保存新的id
this.saveInit();
} else {
/*如果有uuid的情况下
* 1 创建一个新的uuid备用 newUUid
* 2 保存 一下这个新的uuid
* 3 用父级传来的uuid获取配置项
*/
this.newUuid = this.uuid;
// 这里保存备份id
this.saveInit(true);
if (this.newUuid) {
this.getStoreConfig();
}
}
},
//获取配置
getStoreConfig() {
return new Promise((resolve, reject) => {
let params = {
key: this.isAdd
? this.newUuid
: this.isSendCache
? this.cacheUuid
: this.uuid,
currentPage: 1,
pageSize: 20
};
this.axios
.post(
baseUrl +
"/api-plug/get-store-widget-config?requestProject=gic-clique",
qs.stringify(params)
)
.then(res => {
if (res.data.errorCode === 0) {
this.storeType = res.data.result.selectType || 0;
let list = res.data.result.config.result || [];
let computedList = [];
let name = "";
if (this.storeType === 1) {
list.map(v => {
typeList.map(w => {
if (v.id == w.value) {
computedList.push({ id: v.id, name: w.label });
}
});
});
}
leftList.map(v => {
if (this.storeType === v.value) {
name = v.label;
}
});
resolve({
list: this.storeType === 1 ? computedList : list,
type: res.data.result.selectType || 0,
name: name
});
} else {
reject("接口错误");
}
})
.catch(err => {
reject(err);
console.log(err);
});
});
},
// 保存
saveInit(isCacheUuid = false) {
let params = {
selectType: 0,
key: isCacheUuid ? this.cacheUuid : this.newUuid,
isAll: 0,
value: "",
removeItems: "",
isClique: 1
};
this.axios
.post(
baseUrl + "/api-plug/save-store-widget?requestProject=gic-clique",
qs.stringify(params)
)
.then(res => {})
.catch(err => {
console.log(err);
});
},
// 判断门店是否保存
isStoreSave() {
return new Promise((resolve, reject) => {
let params = {
key: this.isAdd
? this.newUuid
: this.isSendCache
? this.cacheUuid
: this.uuid,
selectType: this.storeType
};
if (params.selectType === 0) {
resolve(true);
}
this.axios
.post(
baseUrl + "/api-plug/is-empty?requestProject=gic-clique",
qs.stringify(params)
)
.then(res => {
console.log(res);
if (res.data.errorCode === 0) {
resolve(res.data.result);
} else {
reject(new Error("系统错误"));
}
})
.catch(err => {
reject(new Error("系统错误"));
});
});
}
}
};
</script>
<style lang="scss">
@import url("./index.css");
</style>
/* reset样式 */
.w100 {
width: 100px;
}
.w200 {
width: 200px;
}
.mr5 {
margin-right: 5px;
}
.w240 {
width: 240px!important;
}
.vertical-middle {
vertical-align: middle;
}
.vertical-baseline {
vertical-align: baseline;
}
.inline-block {
vertical-align: middle;
display: inline-block!important;
}
.block {
display: block!important;
}
.gray-color {
color: #909399;
}
.fz13 {
font-size: 13px;
}
.fz12 {
font-size: 12px;
}
.fl {
float: left;
}
.fr {
float: right;
}
.clearfix:after {
display: block;
clear: both;
content: '';
visibility: hidden;
height: 0;
}
.clearfix {
zoom: 1;
}
.vertical-middle {
vertical-align: middle;
}
.block {
display: block;
overflow: hidden;
}
/* reset样式end */
/* 公共样式START */
.dm-store__btn {
text-align: right;
height: 18px;
line-height: 28px;
}
.dm-store__btn--border {
border-top: 1px solid #E4E7ED;
}
.dm-store__btn--cancel {
font-size: 13px;
margin-right: 8px;
}
/* 左右移动的组件 */
.dm-store__wrap {
width: 500px;
height: 378px;
overflow: hidden;
}
.dm-store__left,
.dm-store__right {
display: inline-block;
width: 200px;
height: 376px;
overflow: hidden;
border: 1px solid #E4E7ED;
border-radius: 4px;
vertical-align: middle;
background: #fff;
}
.dm-store__state {
display: flex;
justify-content: space-between;
background: #F5F7FA;
border-bottom: 1px solid #E4E7ED;
height: 40px;
padding: 0 10px;
line-height: 40px;
overflow: hidden;
}
.dm-store__state>* {
vertical-align: middle;
}
.dm-store__search {
margin: 10px;
}
.dm-store__search .el-input__inner {
border-radius: 30px;
}
.dm-store__list {
margin: 0;
overflow-y: auto;
overflow-x: hidden;
height: 284px;
}
.dm-store__item {
height: 34px;
display: flex;
justify-content: space-between;
line-height: 34px;
padding: 0 10px;
}
.dm-store__item .el-icon-close,.dm-store__item .el-icon-circle-close {
color:#909399;
}
.dm-store__item .el-icon-arrow-right {
color:#c0c4cc;
}
.dm-store__list .el-tree-node__label {
text-overflow: ellipsis;
overflow: hidden;
}
.dm-store__item--52 {
height: 52px;
line-height: 52px;
}
.dm-store__item:hover {
background: #F5F7FA;
}
.dm-store__item>i {
line-height: 34px;
}
.dm-store__item--52>i {
line-height: 52px;
}
.dm-store__item .el-checkbox__label {
white-space: nowrap;
text-overflow: ellipsis;
width: 136px;
overflow: hidden;
vertical-align: middle;
}
.dm-store__list--more{
text-align: center;
padding:6px 0;
}
.dm-store__center {
display: inline-block;
vertical-align: middle;
width: 34px;
}
.dm-store__center.dm-store__center--card{
width: 78px;
}
.dm-store__center .el-button.is-circle {
padding: 6px;
}
.dm-store__center .el-button {
display: block;
margin: 10px auto;
}
.dm-store__reference {
position: relative;
}
.dm-store__inputtag {
white-space: nowrap;
overflow: hidden;
padding: 0 6px;
line-height: 28px;
vertical-align: middle;
}
.dm-store__inputtag--tips {
padding: 6px;
}
.dm-store__inputtag .el-tag {
margin-right: 4px;
}
.dm-store__inputtag--total {
position: absolute;
top: 1px;
right: 1px;
background: #fff;
border-radius: 4px;
height: 30px;
line-height: 30px;
font-size: 12px;
padding: 0 6px;
}
.dm-store__total--tag {
margin: 5px;
}
.dm-store__line::after {
display: block;
content: ' ';
height:1px;
width:100%;
background:#E4E7ED;
}
/* 公共样式END */
.dm-store__area {
width: 412px;
height: 403px;
overflow: hidden;
}
.dm-store__type__item {
display: block;
height: 34px;
line-height: 34px;
padding: 0 10px;
}
.dm-store__type__item:hover {
background: #F5F7FA;
}
.dm-store__inner {
position: relative;
vertical-align: middle;
}
.dm-store__card {
width: 490px;
height: 378px;
overflow: hidden;
/* background: #fff; */
}
import storeNew from "./index.vue";
import storeCard from "./card.vue";
import storeGroup from "./group.vue";
const gicStoreNew = {
install(Vue, options) {
Vue.component(storeNew.name, storeNew)
}
}
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(gicStoreNew);
}
export default gicStoreNew;
export const gicStoreCard = {
install(Vue, options) {
Vue.component(storeCard.name, storeCard)
}
}
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(gicStoreCard);
}
export const gicStoreGroup = {
install(Vue, options) {
Vue.component(storeGroup.name, storeGroup)
}
}
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(gicStoreGroup);
}
<template>
<section class="dm-store">
<el-select v-model="storeType" placeholder="请选择" class="w200 inline-block mr5">
<el-option v-for="(v,i) in leftList" :key="i" :label="v.label" :value="v.value"></el-option>
</el-select>
<option-type v-if="storeType === 1" :uuid="newUuid" :cacheUuid="cacheUuid" :isAdd="isAdd" :isCache.sync="isSendCache"></option-type>
<option-tags v-if="storeType === 2" :uuid="newUuid" :cacheUuid="cacheUuid" :isAdd="isAdd" :isCache.sync="isSendCache"></option-tags>
<option-area v-if="storeType === 3" :uuid="newUuid" :cacheUuid="cacheUuid" :isAdd="isAdd" :isCache.sync="isSendCache"></option-area>
<option-group v-if="storeType === 4" :uuid="newUuid" :cacheUuid="cacheUuid" :isAdd="isAdd" :isCache.sync="isSendCache"></option-group>
<option-part v-if="storeType === 5" :uuid="newUuid" :cacheUuid="cacheUuid" :isAdd="isAdd" :isCache.sync="isSendCache"></option-part>
</section>
</template>
<script>
import qs from 'qs';
import uuidv1 from 'uuid/v1';
import { baseUrl } from './config';
import optionType from './options/option-type';
import optionArea from './options/option-area';
import optionTags from './options/option-tags';
import optionGroup from './options/option-group';
import optionPart from './options/option-part';
const leftList = [
{ label: '所有门店', value: 0 },
{ label: '门店类型', value: 1 },
{ label: '门店标签', value: 2 },
{ label: '门店区域', value: 3 },
{ label: '门店分组', value: 4 },
{ label: '部分门店', value: 5 }
];
const typeList = [
{ label: '自营', value: '0' },
{ label: '联营', value: '1' },
{ label: '代理', value: '2' },
{ label: '代销', value: '3' },
{ label: '托管', value: '4' }];
export default {
name: 'vue-gic-store-new',
props: {
uuid: {
type: String,
default: ''
},
options: {
type: Array,
default() {
return [0, 1, 2, 3, 4, 5];
}
},
isAdd: {
type: Boolean,
default: true
},
flag:{
type:Boolean,
default:false
}
},
components: {
'option-type': optionType,
'option-area': optionArea,
'option-tags': optionTags,
'option-group': optionGroup,
'option-part': optionPart
},
watch: {
storeType(val) {
if (!val) {
this.$emit('update:uuid',this.cacheUuid);
// debugger;
this.isSendCache = true;
this.saveInit(this.isSendCache);
}
},
uuid(val) {
// 编辑或者详情
if (val && !this.isAdd) {
if (this.isSendCache) return;
console.log('走到这了');
this.init();
}
},
isSendCache(val) {
if (val) {
this.$emit('update:uuid',this.cacheUuid);
}
}
},
data() {
return {
storeType: 0, // 一级选择值
leftList: [],
// 创建一个新的uuid
newUuid: uuidv1().replace(/-/g,''),
// 编辑情况下的备份id
cacheUuid: uuidv1().replace(/-/g,''), // 生成uuid
// 编辑的情况下是否发送备份ID
isSendCache: false
};
},
created() {
if (this.options instanceof Array) {
leftList.map( v => {
if (this.options.indexOf(v.value) >= 0) {
this.leftList.push(v);
}
});
}
if (!this.flag) {
this.init();
} else {
this.newUuid = this.uuid;
// 这里保存备份id
this.saveInit(true);
if (this.newUuid) {
this.getStoreConfig();
}
}
},
methods: {
// 获取配置项
init() {
this.storeType = 0;
/*如果没有uuid的情况下
1 设置一个新的uuid
2 并传给父级
3 保存
*/
debugger;
if (this.isAdd) {
this.$emit('update:uuid',this.newUuid);
// 这是保存新的id
this.saveInit();
} else {
/*如果有uuid的情况下
*1 创建一个新的uuid备用 newUUid
*2 保存 一下这个新的uuid
*3 用父级传来的uuid获取配置项
*/
this.newUuid = this.uuid;
// 这里保存备份id
this.saveInit(true);
if (this.newUuid) {
this.getStoreConfig();
}
}
},
//获取配置
getStoreConfig() {
return new Promise((resolve,reject) => {
let params = {
key: this.isAdd ? this.newUuid : (this.isSendCache ? this.cacheUuid : this.uuid),
currentPage: 1,
pageSize: 20
};
this.axios.post(baseUrl + '/api-plug/get-store-widget-config?requestProject=gic-web',qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) {
this.storeType = res.data.result.selectType || 0;
let list = res.data.result.config.result || [];
let computedList = [];
let name = '';
if (this.storeType === 1) {
list.map(v => {
typeList.map(w => {
if (v.id === w.value) {
computedList.push({ id: v.id, name: w.label });
}
});
});
}
leftList.map(v => {
if (this.storeType === v.value) {
name = v.label;
}
});
resolve({ list: this.storeType === 1 ? computedList : list, type: res.data.result.selectType || 0, name: name });
} else {
reject(new Error('接口错误'));
}
}).catch(err => {
reject(err);
console.log(err);
});
});
},
// 保存
saveInit(isCacheUuid = false) {
let params = {
selectType: 0,
key: isCacheUuid ? this.cacheUuid : this.newUuid,
isAll: 0,
value: '',
removeItems: '',
isClique: 0
};
this.axios.post(baseUrl + '/api-plug/save-store-widget?requestProject=gic-web',qs.stringify(params)).then(res => {
}).catch(err => {
console.log(err);
});
},
// 判断门店是否保存
isStoreSave() {
return new Promise((resolve,reject) => {
let params = {
key: this.isAdd ? this.newUuid : (this.isSendCache ? this.cacheUuid : this.uuid),
selectType: this.storeType
};
if (params.selectType === 0) {
resolve(true);
}
this.axios.post(baseUrl + '/api-plug/is-empty?requestProject=gic-web',qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) {
resolve(res.data.result);
} else {
reject(new Error('系统错误'));
}
}).catch( err => {
console.log(err);
});
});
}
}
};
</script>
<style lang="scss">
@import url('./index.css');
</style>
<template>
<el-popover class="vertical-baseline" placement="bottom-start" width="406" height="400" trigger="click" v-model="popoverShow">
<div class="dm-store__area" style="height: 400px;">
<!-- 左侧 -->
<div class="dm-store__left">
<div class="dm-store__list" style="height:100%;">
<div v-for="(v,i) in areaList" :key="i" class="dm-store__item" @click="clickProvince(v,i)">
<div>
<el-checkbox class="inline-block" :indeterminate="v.indeterminate" v-model="v.isCheck" @change="checkProvinceChange(v,i)"></el-checkbox>
<span class="inline-block"> {{v.provinceName}}</span>
</div>
<i class="el-icon-arrow-right"></i>
</div>
</div>
</div>
<!-- 右侧 -->
<div class="dm-store__right">
<div class="dm-store__list" style="height:100%;">
<p v-for="(v,i) in currentCityList" :key="i" class="dm-store__item">
<el-checkbox v-model="v.isCheck" @change="checkCityChange(v)">{{v.cityName}}</el-checkbox>
</p>
</div>
</div>
<!-- 操作按钮 -->
<div class="dm-store__btn">
<span class="dm-store__btn--cancel" @click="popoverShow = false">取 消</span>
<el-button class="dm-store__btn--cancel" type="text" @click="saveArea">确 定</el-button>
</div>
</div>
<!-- 展示区 -->
<div class="el-input dm-store__reference w240" slot="reference">
<div class="el-input__inner block">
已选择{{totalProvince}}个省、{{totalCity}}个市
</div>
</div>
</el-popover>
</template>
<script>
import qs from 'qs';
import { baseUrl } from '../config';
export default {
name: 'options-area',
props: {
uuid: {
type:String,
default:''
},
cacheUuid:{
type:String,
default:''
},
isAdd:{
type:Boolean,
default:true
},
isCache:{
type:Boolean,
default:false
}
},
watch: {
areaList:{
/* indeterminate isCheck
* true true 半勾选
* false false 不选
* false true 全选
*/
handler(val) {
// 全选计算省数量
this.totalProvince = this.areaList.filter(v => (!v.indeterminate && v.isCheck)).length;
this.totalCity = 0;
this.areaList.map(v => {
// 半勾选计算市数量
if ( v.isCheck && v.children.length) {
v.children.map(w => {
if (w.isCheck) {
this.totalCity ++
}
})
}
})
},
deep:true
}
},
data() {
return {
popoverShow:false,
areaList:[],
currentCityList:[],
currentIndex:0,
totalCity:0,
totalProvince:0,
defaultProps: {
children: 'children',
label: 'label',
id:'id'
},
params:{
selectType:3, // 是 int 下拉选择项
key:'', // 是 string 32位唯一值
isAll:0, // 是 int 是否勾选全部 1是 0否
value:'', //否 string isAll=0时,必填,选中项id,多个逗号分隔
removeItems:'', //否 string isAll=1,取消选中项的id,多个逗号分隔
isClique:0
},
}
},
created() {
this.getAreaTree();
if (!this.isAdd) {
this.copyStoreWidget();
}
console.log(this.uuid,this.cacheUuid);
},
methods: {
// 获取树形结构
async getAreaTree() {
let res = await this.axios.get(baseUrl + '/api-plug/dict-district-tree?requestProject=gic-web')
this.areaList = res.data.result.map(v => ({
isCheck:false,
indeterminate:false,
label:v.provinceName,
id:v.provinceId,
...v,
children:v.children.map(w => ({
isCheck:false,
label:w.cityName,
id:w.cityId,
...w
}))
}))
await this.getCheckedData();
},
// 获取已选择项
getCheckedData() {
return new Promise((resolve,reject) => {
let params = {
key:this.isCache ? this.cacheUuid : this.uuid,
selectType:3,
search:'',
currentPage:1,
pageSize:3000
}
this.axios.post(baseUrl + '/api-plug/list-right-data?requestProject=gic-web',qs.stringify(params)).then(res => {
let list = (res.data.result && res.data.result.result) || [];
list.map(u => u.id).map(u => {
this.areaList.map(v => {
// 全选 市一起勾选
if (u === v.provinceId) {
v.indeterminate = false;
v.isCheck = true;
v.children.map(w => {
w.isCheck = true;
})
}
// 半勾选
v.children.map(w => {
if (u === w.cityId) {
w.isCheck = true;
v.indeterminate = true;
v.isCheck = true;
}
})
})
})
}).catch(err => {
console.log(err)
})
})
},
clickProvince(item,index) {
this.currentIndex = index;
this.currentCityList = item.children || [];
},
checkProvinceChange(item,index) {
this.currentIndex = index;
this.currentCityList = item.children || [];
item.children.map(v => {
v.isCheck = item.isCheck;
});
if (item.children.length) {
const isAllCheck = item.children.every(v => v.isCheck);
const isSomeCheck = item.children.some(v => v.isCheck);
item.isCheck = isSomeCheck;
item.indeterminate = !isAllCheck && isSomeCheck;
}
},
/* indeterminate isCheck
* true true 半勾选
* false false 不选
* false true 全选
*/
checkCityChange() {
let item = this.areaList[this.currentIndex];
const isAllCheck = item.children.every(v => v.isCheck);
const isSomeCheck = item.children.some(v => v.isCheck);
item.isCheck = isSomeCheck;
item.indeterminate = !isAllCheck && isSomeCheck;
console.log(item.indeterminate,item.isCheck);
},
saveArea() {
this.params.key = this.isAdd ? this.uuid: this.cacheUuid;
let valueList = [];
this.areaList.map(v => {
// 全选 只传省ID
if(!v.indeterminate && v.isCheck) {
valueList.push(v.provinceId)
}
if(v.indeterminate && v.isCheck && v.children.length) {
// 半选 传市id
v.children.map(w => {
if (w.isCheck) {
valueList.push(w.cityId)
}
})
}
});
this.params.value = valueList.filter(v => v).join(',');
if (!this.params.value) {
this.$message({type:"warning",message:"门店选择不能为空"});
return;
}
this.axios.post(baseUrl + '/api-plug/save-store-widget?requestProject=gic-web',qs.stringify(this.params)).then(res => {
if (res.data.errorCode === 0) {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.popoverShow = false;
} else {
this.$message({type:'error',message:'保存失败'});
}
}).catch(err => {
console.log(err)
})
},
// 把老数据拷贝到新的临时id上
copyStoreWidget() {
this.axios.get(baseUrl + '/api-plug/copy-store-widget?requestProject=gic-web&oldKey='+this.uuid+'&newKey='+this.cacheUuid).then(res => {
if (res.data.errorCode === 0) {
console.log('拷贝成功');
}
})
}
}
}
</script>
<template>
<el-popover class="vertical-baseline" placement="bottom-start" width="446" height="378" trigger="click" v-model="popoverShow">
<div class="dm-store__wrap" style="height: 378px;">
<!-- 左侧 -->
<div class="dm-store__left">
<div class="dm-store__state">
<span>选择</span>
<!-- <el-checkbox v-model="params.isAll" :true-label="1" :false-label="0" @change="handleCheckAllChange">所有门店</el-checkbox> -->
<!-- <span class="fz13">{{params.isAll?leftTotal:leftCheckList.length}}/{{leftTotal}}</span> -->
</div>
<div class="dm-store__search">
<el-input v-model="leftValue" placeholder="请输入门店名称" prefix-icon="el-icon-search" @change="getLeftList"></el-input>
</div>
<el-tree ref="tree" class="dm-store__list" :data="leftList" :default-expand-all="true" show-checkbox node-key="storeGroupId" :props="defaultProps"></el-tree>
</div>
<div class="dm-store__center">
<el-button type="primary" icon="el-icon-arrow-right" circle @click="saveToRight"></el-button>
<el-button icon="el-icon-close" circle :disabled="!rightCheckList.length" @click="deleteRightItems(false)"></el-button>
</div>
<!-- 右侧 -->
<div class="dm-store__right">
<div class="dm-store__state">
<span>已选<span class="fz12 gray-color">{{rightTotal}}个类型)</span></span>
<el-button type="text" @click="deleteRightAll">全部清除</el-button>
</div>
<div class="dm-store__search">
<el-input v-model="rightValue" placeholder="请输入门店名称" prefix-icon="el-icon-search" @change="getRightList"></el-input>
</div>
<el-checkbox-group v-model="rightCheckList" class="dm-store__list">
<p v-for="(v,i) in rightList" :key="i" class="dm-store__item" @mouseover="rightHoverIndex = i" @mouseout="rightHoverIndex = null">
<el-checkbox :label="v.id">{{v.name}}</el-checkbox>
<i class="el-icon-close" v-show="rightHoverIndex !== i"></i>
<i class="el-icon-circle-close" v-show="rightHoverIndex === i" @click.stop="deleteRightItems(v.id)"></i>
</p>
</el-checkbox-group>
</div>
</div>
<!-- 展示区 -->
<div class="el-input dm-store__reference w240" slot="reference">
<div class="el-input__inner dm-store__inputtag">
<el-tag size="small" v-for="v in rightList" :key="v.id" @close="deleteRightItems(v.id)" closable>{{v.name}}</el-tag>
<span class="gray-color dm-store__inputtag--tips" v-show="rightList.length === 0">请选择门店</span>
</div>
<el-popover placement="top-start" popper-class="select-shop__popper" width="300" trigger="hover">
<el-tag class="dm-store__total--tag" v-for="v in rightList" :key="v.id" @close="deleteRightItems(v.id)" closable>
{{v.name}}
</el-tag>
<span slot="reference" class="dm-store__inputtag--total" v-show="rightList.length">{{params.isAll?rightTotal:rightList.length}}</span>
</el-popover>
</div>
<!-- 操作按钮 -->
<div class="dm-store__btn">
<el-button class="dm-store__btn--cancel" type="text" @click="popoverShow = false">确 定</el-button>
</div>
</el-popover>
</template>
<script>
import qs from 'qs';
import { baseUrl } from '../config';
export default {
name:'options-group',
props:{
uuid:{
type:String,
default:''
},
cacheUuid:{
type:String,
default:''
},
isAdd:{
type:Boolean,
default:true
},
isCache:{
type:Boolean,
default:false
}
},
data() {
return {
popoverShow:false,
leftList:[],
rightList:[],
leftValue:'',
rightValue:'',
leftCheckList:[],
rightCheckList:[],
params:{
selectType:4, // 是 int 下拉选择项
key:'', // 是 string 32位唯一值
isAll:0, // 是 int 是否勾选全部 1是 0否
value:'', //否 string isAll=0时,必填,选中项id,多个逗号分隔
removeItems:'', //否 string isAll=1,取消选中项的id,多个逗号分隔
isClique:0
},
isIndeterminate: true,
rightHoverIndex:null,
rightTotal:0,
leftTotal:0,
defaultProps:{
id:'storeGroupId',
label:'storeGroupName',
children:'children'
}
}
},
created() {
this.getLeftList().then(_ => {
this.getRightList();
});
if (!this.isAdd) {
this.copyStoreWidget();
}
console.log(this.uuid,this.cacheUuid);
},
methods:{
// 拉取左侧数据
getLeftList() {
return new Promise((resolve,reject) => {
this.axios.get(baseUrl + '/api-plug/store-group-list?requestProject=gic-web&search='+this.leftValue).then(res => {
this.leftList = res.data.result || [];
resolve();
// this.leftTotal = res.data.result.totalCount || 0;
}).catch(err => {
reject();
console.log(err)
})
})
},
// 拉取右侧数据
getRightList() {
let params = {
key:this.isCache ? this.cacheUuid : this.uuid,
selectType:4,
search:this.rightValue,
currentPage:1,
pageSize:999
}
this.axios.post(baseUrl + '/api-plug/list-right-data?requestProject=gic-web',qs.stringify(params)).then(res => {
this.rightList = (res.data.result && res.data.result.result) || [];
this.rightTotal = (res.data.result && res.data.result.totalCount) || 0;
this.$nextTick(_ => {
this.$refs.tree.setCheckedKeys(this.rightList.map(v => v.id));
})
}).catch(err => {
console.log(err)
})
},
// 左侧数据移动到右侧
saveToRight() {
this.params.key = this.isAdd ? this.uuid: this.cacheUuid;
if (this.params.isAll) {
this.params.removeItems = this.leftList.filter(v => {
return this.leftCheckList.indexOf(v.tagId) < 0;
}).map(v => v.tagId).join(',');
} else {
this.params.value = this.$refs.tree.getCheckedKeys().join(',');
if (!this.params.value) {
this.$message({type:"warning",message:"门店选择不能为空"});
return;
}
}
this.axios.post(baseUrl + '/api-plug/save-store-widget?requestProject=gic-web',qs.stringify(this.params)).then(res => {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
})
}).catch(err => {
console.log(err)
})
},
// 删除右侧全部
deleteRightAll() {
this.axios.get(baseUrl + '/api-plug/remove-allitems?requestProject=gic-web&key=' + (this.isAdd ? this.uuid: this.cacheUuid)).then(res => {
if (res.data.errorCode === 0) {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
})
} else {
this.$message({type:'error',message:'清除全部失败'});
}
}).catch(err => {
console.log(err)
})
},
// 删除右侧单选或者多选数据
deleteRightItems(item) {
let params = {
key:this.isAdd ? this.uuid : this.cacheUuid,
removeItems:item || this.rightCheckList.join(',')
}
console.log(this.isAdd,this.uuid ,this.cacheUuid)
this.params.value = this.leftCheckList.join(',');
// console.log(url);
this.axios.post(baseUrl + '/api-plug/remove-items?requestProject=gic-web',qs.stringify(params)).then(res => {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
this.rightCheckList = [];
})
}).catch(err => {
console.log(err)
})
},
// 选中所有数据
handleCheckAllChange(val) {
this.leftCheckList = val ? this.leftList.map(v => v.tagId) : [];
},
// 把老数据拷贝到新的临时id上
copyStoreWidget() {
this.axios.get(baseUrl + '/api-plug/copy-store-widget?requestProject=gic-web&oldKey='+this.uuid+'&newKey='+this.cacheUuid).then(res => {
if(res.data.errorCode === 0) {
console.log('拷贝成功');
}
})
}
}
}
</script>
<template>
<el-popover class="vertical-baseline" placement="bottom-start" width="214" trigger="click" v-model="popoverShow">
<el-checkbox-group v-model="checkedList" @change="saveToRight">
<label :name="v.value" class="dm-store__type__item" v-for="(v,i) in typeList" :key="i">
<el-checkbox :label="v.value">{{v.label}}</el-checkbox>
</label>
</el-checkbox-group>
<div class="dm-store__line"></div>
<div class="el-input dm-store__reference w240" slot="reference">
<div class="el-input__inner dm-store__inputtag">
<el-tag v-for="(v,i) in checkedList" size="small" :key="i" closable @close="delItem(v)">{{filterLabel(v)}}</el-tag>
<span class="gray-color dm-store__inputtag--tips" v-show="checkedList.length === 0">请选择门店</span>
</div>
<el-popover placement="top-start" popper-class="select-shop__popper" width="300" trigger="hover">
<el-tag v-for="(v,i) in checkedList" class="dm-store__total--tag" size="small" :key="i" closable @close="delItem(v)">{{filterLabel(v)}}</el-tag>
<span slot="reference" class="dm-store__inputtag--total" v-show="checkedList.length">{{checkedList.length}}</span>
</el-popover>
</div>
<!-- 操作按钮 -->
<div class="dm-store__btn">
<el-button class="dm-store__btn--cancel" type="text" @click="popoverShow = false">确 定</el-button>
</div>
</el-popover>
</template>
<script>
import qs from 'qs';
import { baseUrl } from '../config';
export default {
name: 'options-type',
props: {
uuid: {
type: String,
default: ''
},
cacheUuid: {
type: String,
default: ''
},
isAdd: {
type: Boolean,
default: true
},
isCache: {
type: Boolean,
default: false
}
},
created() {
this.getRightList();
if (!this.isAdd) {
this.copyStoreWidget();
}
console.log(this.uuid,this.cacheUuid);
},
data() {
return {
typeList: [
{ label: '自营', value: '0' },
{ label: '联营', value: '1' },
{ label: '代理', value: '2' },
{ label: '代销', value: '3' },
{ label: '托管', value: '4' }
],
checkedList: [],
popoverShow: false,
params: {
selectType: 1, //下拉选择项
key: '', // 32位唯一值
isAll: 0, //是否勾选全部 1是 0否
value: '', //isAll=0时,必填,选中项id,多个逗号分隔
removeItems: '', //isAll=1,取消选中项的id,多个逗号分隔
isClique: 0
}
};
},
methods: {
// label 的filter
filterLabel(val) {
let result = '';
this.typeList.map( v => {
if (val === v.value) {
result = v.label;
}
})
return result;
},
// 拉取右侧数据
getRightList() {
let params = {
key: this.isCache ? this.cacheUuid : this.uuid,
selectType: 1,
search: '',
currentPage: 1,
pageSize: 20
};
this.axios.post(baseUrl + '/api-plug/list-right-data?requestProject=gic-web',qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) {
this.checkedList = ((res.data.result && res.data.result.result) || []).map(v => v.id);
}
}).catch(err => {
console.log(err);
})
},
// 保存
saveToRight() {
this.params.key = this.isAdd ? this.uuid : this.cacheUuid;
this.params.value = this.checkedList.join(',');
if (!this.params.value) {
this.$message({ type: "warning", message: "门店选择不能为空" });
return;
}
this.axios.post(baseUrl + '/api-plug/save-store-widget?requestProject=gic-web',qs.stringify(this.params)).then(res => {
// 如果是编辑 并且有操作 把isCache设为true 最终保存是临时id
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
}).catch(err => {
console.log(err)
})
},
// 删除右侧单选或者多选数据
delItem(v) {
let params = {
key: this.isAdd ? this.uuid : this.cacheUuid,
removeItems: v,
value: ''
};
console.log(this.isAdd, this.uuid, this.cacheUuid)
this.axios.post(baseUrl + '/api-plug/remove-items?requestProject=gic-web', qs.stringify(params)).then(res => {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
})
}).catch(err => {
console.log(err)
})
},
// 把老数据拷贝到新的临时id上
copyStoreWidget() {
this.axios.get(baseUrl + '/api-plug/copy-store-widget?requestProject=gic-web&oldKey=' + this.uuid + '&newKey=' + this.cacheUuid).then(res => {
if (res.data.errorCode === 0) {
console.log('拷贝成功');
}
})
}
}
};
</script>
<template>
<el-popover class="vertical-baseline" placement="bottom-start" width="406" height="400" trigger="click" v-model="popoverShow">
<div class="dm-store__area" style="height: 400px;">
<!-- 左侧 -->
<div class="dm-store__left">
<div class="dm-store__list" style="height:100%;">
<div v-for="(v,i) in areaList" :key="i" class="dm-store__item" @click="clickProvince(v,i)">
<div>
<el-checkbox class="inline-block" :indeterminate="v.indeterminate" v-model="v.isCheck" @change="checkProvinceChange(v,i)"></el-checkbox>
<span class="inline-block"> {{v.provinceName}}</span>
</div>
<i class="el-icon-arrow-right"></i>
</div>
</div>
</div>
<!-- 右侧 -->
<div class="dm-store__right">
<div class="dm-store__list" style="height:100%;">
<p v-for="(v,i) in currentCityList" :key="i" class="dm-store__item">
<el-checkbox v-model="v.isCheck" @change="checkCityChange(v)">{{v.cityName}}</el-checkbox>
</p>
</div>
</div>
<!-- 操作按钮 -->
<div class="dm-store__btn">
<span class="dm-store__btn--cancel" @click="popoverShow = false">取 消</span>
<el-button class="dm-store__btn--cancel" type="text" @click="saveArea">确 定</el-button>
</div>
</div>
<!-- 展示区 -->
<div class="el-input dm-store__reference w240" slot="reference">
<div class="el-input__inner block">
已选择{{totalProvince}}个省、{{totalCity}}个市
</div>
</div>
</el-popover>
</template>
<script>
import qs from 'qs';
import { baseUrl } from '../config';
export default {
name: 'options-area',
props: {
uuid: {
type:String,
default:''
},
cacheUuid:{
type:String,
default:''
},
isAdd:{
type:Boolean,
default:true
},
isCache:{
type:Boolean,
default:false
}
},
watch: {
areaList:{
/* indeterminate isCheck
* true true 半勾选
* false false 不选
* false true 全选
*/
handler(val) {
// 全选计算省数量
this.totalProvince = this.areaList.filter(v => (!v.indeterminate && v.isCheck)).length;
this.totalCity = 0;
this.areaList.map(v => {
// 半勾选计算市数量
if ( v.isCheck && v.children.length) {
v.children.map(w => {
if (w.isCheck) {
this.totalCity ++
}
})
}
})
},
deep:true
}
},
data() {
return {
popoverShow:false,
areaList:[],
currentCityList:[],
currentIndex:0,
totalCity:0,
totalProvince:0,
defaultProps: {
children: 'children',
label: 'label',
id:'id'
},
params:{
selectType:3, // 是 int 下拉选择项
key:'', // 是 string 32位唯一值
isAll:0, // 是 int 是否勾选全部 1是 0否
value:'', //否 string isAll=0时,必填,选中项id,多个逗号分隔
removeItems:'', //否 string isAll=1,取消选中项的id,多个逗号分隔
isClique:1
},
}
},
created() {
this.getAreaTree();
if (!this.isAdd) {
this.copyStoreWidget();
}
console.log(this.uuid,this.cacheUuid);
},
methods:{
// 获取树形结构
async getAreaTree() {
let res = await this.axios.get(baseUrl + '/api-plug/dict-district-tree?requestProject=gic-clique')
this.areaList = res.data.result.map(v => ({
isCheck:false,
indeterminate:false,
label:v.provinceName,
id:v.provinceId,
...v,
children:v.children.map(w => ({
isCheck:false,
label:w.cityName,
id:w.cityId,
...w
}))
}))
await this.getCheckedData();
},
// 获取已选择项
getCheckedData() {
return new Promise((resolve,reject) => {
let params = {
key:this.isCache ? this.cacheUuid : this.uuid,
selectType:3,
search:'',
currentPage:1,
pageSize:3000
}
this.axios.post(baseUrl + '/api-plug/list-right-data?requestProject=gic-clique',qs.stringify(params)).then(res => {
let list = (res.data.result && res.data.result.result) || [];
list.map(u => u.id).map(u => {
this.areaList.map(v => {
// 全选 市一起勾选
if (u === v.provinceId) {
v.indeterminate = false;
v.isCheck = true;
v.children.map(w => {
w.isCheck = true;
})
}
// 半勾选
v.children.map(w => {
if (u === w.cityId) {
w.isCheck = true;
v.indeterminate = true;
v.isCheck = true;
}
})
})
})
}).catch(err => {
console.log(err)
})
})
},
clickProvince(item,index) {
this.currentIndex = index;
this.currentCityList = item.children || [];
},
checkProvinceChange(item,index) {
this.currentIndex = index;
this.currentCityList = item.children || [];
item.children.map(v => {
v.isCheck = item.isCheck;
});
if (item.children.length) {
const isAllCheck = item.children.every(v => v.isCheck);
const isSomeCheck = item.children.some(v => v.isCheck);
item.isCheck = isSomeCheck;
item.indeterminate = !isAllCheck && isSomeCheck;
}
},
/* indeterminate isCheck
* true true 半勾选
* false false 不选
* false true 全选
*/
checkCityChange() {
let item = this.areaList[this.currentIndex];
const isAllCheck = item.children.every(v => v.isCheck);
const isSomeCheck = item.children.some(v => v.isCheck);
item.isCheck = isSomeCheck;
item.indeterminate = !isAllCheck && isSomeCheck;
console.log(item.indeterminate,item.isCheck);
},
saveArea() {
this.params.key = this.isAdd ? this.uuid: this.cacheUuid;
let valueList = [];
this.areaList.map(v => {
// 全选 只传省ID
if(!v.indeterminate && v.isCheck) {
valueList.push(v.provinceId)
}
if(v.indeterminate && v.isCheck && v.children.length) {
// 半选 传市id
v.children.map(w => {
if (w.isCheck) {
valueList.push(w.cityId)
}
})
}
});
this.params.value = valueList.filter(v => v).join(',');
if (!this.params.value) {
this.$message({type:"warning",message:"门店选择不能为空"});
return;
}
this.axios.post(baseUrl + '/api-plug/save-store-widget?requestProject=gic-clique',qs.stringify(this.params)).then(res => {
if (res.data.errorCode === 0) {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.popoverShow = false;
} else {
this.$message({type:'error',message:'保存失败'});
}
}).catch(err => {
console.log(err)
})
},
// 把老数据拷贝到新的临时id上
copyStoreWidget() {
this.axios.get(baseUrl + '/api-plug/copy-store-widget?requestProject=gic-clique&oldKey='+this.uuid+'&newKey='+this.cacheUuid).then(res => {
if(res.data.errorCode === 0) {
console.log('拷贝成功');
}
})
}
}
}
</script>
<template>
<el-popover class="vertical-baseline" placement="bottom-start" width="446" height="378" trigger="click" v-model="popoverShow">
<div class="dm-store__wrap" style="height: 378px;">
<!-- 左侧 -->
<div class="dm-store__left">
<div class="dm-store__state">
<span>选择</span>
<!-- <el-checkbox v-model="params.isAll" :true-label="1" :false-label="0" @change="handleCheckAllChange">所有门店</el-checkbox> -->
<!-- <span class="fz13">{{params.isAll?leftTotal:leftCheckList.length}}/{{leftTotal}}</span> -->
</div>
<div class="dm-store__search">
<el-input v-model="leftValue" placeholder="请输入门店名称" prefix-icon="el-icon-search" @change="getLeftList"></el-input>
</div>
<el-tree ref="tree" class="dm-store__list" :data="leftList" :default-expand-all="true" show-checkbox node-key="storeGroupId" :props="defaultProps"></el-tree>
</div>
<div class="dm-store__center">
<el-button type="primary" icon="el-icon-arrow-right" circle @click="saveToRight"></el-button>
<el-button icon="el-icon-close" circle :disabled="!rightCheckList.length" @click="deleteRightItems(false)"></el-button>
</div>
<!-- 右侧 -->
<div class="dm-store__right">
<div class="dm-store__state">
<span>已选<span class="fz12 gray-color">{{rightTotal}}个类型)</span></span>
<el-button type="text" @click="deleteRightAll">全部清除</el-button>
</div>
<div class="dm-store__search">
<el-input v-model="rightValue" placeholder="请输入门店名称" prefix-icon="el-icon-search" @change="getRightList"></el-input>
</div>
<el-checkbox-group v-model="rightCheckList" class="dm-store__list">
<p v-for="(v,i) in rightList" :key="i" class="dm-store__item" @mouseover="rightHoverIndex = i" @mouseout="rightHoverIndex = null">
<el-checkbox :label="v.id">{{v.name}}</el-checkbox>
<i class="el-icon-close" v-show="rightHoverIndex !== i"></i>
<i class="el-icon-circle-close" v-show="rightHoverIndex === i" @click.stop="deleteRightItems(v.id)"></i>
</p>
</el-checkbox-group>
</div>
</div>
<!-- 展示区 -->
<div class="el-input dm-store__reference w240" slot="reference">
<div class="el-input__inner dm-store__inputtag">
<el-tag size="small" v-for="v in rightList" :key="v.id" @close="deleteRightItems(v.id)" closable>{{v.name}}</el-tag>
<span class="gray-color dm-store__inputtag--tips" v-show="rightList.length === 0">请选择门店</span>
</div>
<el-popover placement="top-start" popper-class="select-shop__popper" width="300" trigger="hover">
<el-tag class="dm-store__total--tag" v-for="v in rightList" :key="v.id" @close="deleteRightItems(v.id)" closable>
{{v.name}}
</el-tag>
<span slot="reference" class="dm-store__inputtag--total" v-show="rightList.length">{{params.isAll?rightTotal:rightList.length}}</span>
</el-popover>
</div>
<!-- 操作按钮 -->
<div class="dm-store__btn">
<el-button class="dm-store__btn--cancel" type="text" @click="popoverShow = false">确 定</el-button>
</div>
</el-popover>
</template>
<script>
import qs from 'qs';
import { baseUrl } from '../config';
export default {
name:'options-group',
props:{
uuid:{
type:String,
default:''
},
cacheUuid:{
type:String,
default:''
},
isAdd:{
type:Boolean,
default:true
},
isCache:{
type:Boolean,
default:false
}
},
data() {
return {
popoverShow:false,
leftList:[],
rightList:[],
leftValue:'',
rightValue:'',
leftCheckList:[],
rightCheckList:[],
params:{
selectType:4, // 是 int 下拉选择项
key:'', // 是 string 32位唯一值
isAll:0, // 是 int 是否勾选全部 1是 0否
value:'', //否 string isAll=0时,必填,选中项id,多个逗号分隔
removeItems:'', //否 string isAll=1,取消选中项的id,多个逗号分隔
isClique:1
},
isIndeterminate: true,
rightHoverIndex:null,
rightTotal:0,
leftTotal:0,
defaultProps:{
id:'storeGroupId',
label:'storeGroupName',
children:'children'
}
}
},
created() {
this.getLeftList().then(_ => {
this.getRightList();
});
if (!this.isAdd) {
this.copyStoreWidget();
}
console.log(this.uuid,this.cacheUuid);
},
methods:{
// 拉取左侧数据
getLeftList() {
return new Promise((resolve,reject) => {
this.axios.get(baseUrl + '/api-plug/clique-store-group-list?requestProject=gic-clique&search='+this.leftValue).then(res => {
this.leftList = res.data.result || [];
resolve();
// this.leftTotal = res.data.result.totalCount || 0;
}).catch(err => {
reject();
console.log(err)
})
})
},
// 拉取右侧数据
getRightList() {
let params = {
key:this.isCache ? this.cacheUuid : this.uuid,
selectType:4,
search:this.rightValue,
currentPage:1,
pageSize:999
}
this.axios.post(baseUrl + '/api-plug/list-right-data?requestProject=gic-clique',qs.stringify(params)).then(res => {
this.rightList = (res.data.result && res.data.result.result) || [];
this.rightTotal = (res.data.result && res.data.result.totalCount) || 0;
this.$nextTick(_ => {
this.$refs.tree.setCheckedKeys(this.rightList.map(v => v.id));
})
}).catch(err => {
console.log(err)
})
},
// 左侧数据移动到右侧
saveToRight() {
this.params.key = this.isAdd ? this.uuid: this.cacheUuid;
if (this.params.isAll) {
this.params.removeItems = this.leftList.filter(v => {
return this.leftCheckList.indexOf(v.tagId) < 0;
}).map(v => v.tagId).join(',');
} else {
this.params.value = this.$refs.tree.getCheckedKeys().join(',');
if (!this.params.value) {
this.$message({type:"warning",message:"门店选择不能为空"});
return;
}
}
this.axios.post(baseUrl + '/api-plug/save-store-widget?requestProject=gic-clique',qs.stringify(this.params)).then(res => {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
})
}).catch(err => {
console.log(err)
})
},
// 删除右侧全部
deleteRightAll() {
this.axios.get(baseUrl + '/api-plug/remove-allitems?requestProject=gic-clique&key=' + (this.isAdd ? this.uuid: this.cacheUuid)).then(res => {
if (res.data.errorCode === 0) {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
})
} else {
this.$message({type:'error',message:'清除全部失败'});
}
}).catch(err => {
console.log(err)
})
},
// 删除右侧单选或者多选数据
deleteRightItems(item) {
let params = {
key:this.isAdd ? this.uuid : this.cacheUuid,
removeItems:item || this.rightCheckList.join(',')
}
console.log(this.isAdd,this.uuid ,this.cacheUuid)
this.params.value = this.leftCheckList.join(',');
// console.log(url);
this.axios.post(baseUrl + '/api-plug/remove-items?requestProject=gic-clique',qs.stringify(params)).then(res => {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
this.rightCheckList = [];
})
}).catch(err => {
console.log(err)
})
},
// 选中所有数据
handleCheckAllChange(val) {
this.leftCheckList = val ? this.leftList.map(v => v.tagId) : [];
},
// 把老数据拷贝到新的临时id上
copyStoreWidget() {
this.axios.get(baseUrl + '/api-plug/copy-store-widget?requestProject=gic-clique&oldKey='+this.uuid+'&newKey='+this.cacheUuid).then(res => {
if(res.data.errorCode === 0) {
console.log('拷贝成功');
}
})
}
}
}
</script>
<template>
<el-popover class="vertical-baseline" placement="bottom-start" width="446" height="378" trigger="click" v-model="popoverShow">
<div class="dm-store__wrap" style="height: 378px;">
<!-- 左侧 -->
<div class="dm-store__left">
<div class="dm-store__state">
<span>选择</span>
<!-- <el-checkbox v-model="params.isAll" :true-label="1" :false-label="0" @change="handleCheckAllChange">所有门店</el-checkbox> -->
<!-- <span class="fz13">{{params.isAll?leftTotal:leftCheckList.length}}/{{leftTotal}}</span> -->
</div>
<div class="dm-store__search">
<el-input v-model="leftValue" placeholder="请输入门店名称" prefix-icon="el-icon-search" @change="getLeftList"></el-input>
</div>
<el-tree ref="tree" class="dm-store__list" :data="leftList" :default-expand-all="true" show-checkbox node-key="tagId" :props="defaultProps"></el-tree>
</div>
<div class="dm-store__center">
<el-button type="primary" icon="el-icon-arrow-right" circle @click="saveToRight"></el-button>
<el-button icon="el-icon-close" circle :disabled="!rightCheckList.length" @click="deleteRightItems(false)"></el-button>
</div>
<!-- 右侧 -->
<div class="dm-store__right">
<div class="dm-store__state">
<span>已选<span class="fz12 gray-color">{{rightTotal}}个类型)</span></span>
<el-button type="text" @click="deleteRightAll">全部清除</el-button>
</div>
<div class="dm-store__search">
<el-input v-model="rightValue" placeholder="请输入门店名称" prefix-icon="el-icon-search" @change="getRightList"></el-input>
</div>
<el-checkbox-group v-model="rightCheckList" class="dm-store__list">
<p v-for="(v,i) in rightList" :key="i" class="dm-store__item" @mouseover="rightHoverIndex = i" @mouseout="rightHoverIndex = null">
<el-checkbox :label="v.id">{{v.name}}</el-checkbox>
<i class="el-icon-close" v-show="rightHoverIndex !== i"></i>
<i class="el-icon-circle-close" v-show="rightHoverIndex === i" @click.stop="deleteRightItems(v.id)"></i>
</p>
</el-checkbox-group>
</div>
</div>
<!-- 展示区 -->
<div class="el-input dm-store__reference w240" slot="reference">
<div class="el-input__inner dm-store__inputtag">
<el-tag size="small" v-for="v in rightList" :key="v.id" @close="deleteRightItems(v.id)" closable>{{v.name}}</el-tag>
<span class="gray-color dm-store__inputtag--tips" v-show="rightList.length === 0">请选择门店</span>
</div>
<el-popover placement="top-start" popper-class="select-shop__popper" width="300" trigger="hover">
<el-tag class="dm-store__total--tag" v-for="v in rightList" :key="v.id" @close="deleteRightItems(v.id)" closable>
{{v.name}}
</el-tag>
<span slot="reference" class="dm-store__inputtag--total" v-show="rightList.length">{{params.isAll?rightTotal:rightList.length}}</span>
</el-popover>
</div>
<!-- 操作按钮 -->
<div class="dm-store__btn">
<el-button class="dm-store__btn--cancel" type="text" @click="popoverShow = false">确 定</el-button>
</div>
</el-popover>
</template>
<script>
import qs from 'qs';
import { baseUrl } from '../config';
export default {
name:'options-group',
props:{
uuid:{
type:String,
default:''
},
cacheUuid:{
type:String,
default:''
},
isAdd:{
type:Boolean,
default:true
},
isCache:{
type:Boolean,
default:false
}
},
data() {
return {
popoverShow:false,
leftList:[],
rightList:[],
leftValue:'',
rightValue:'',
leftCheckList:[],
rightCheckList:[],
params:{
selectType:2, // 是 int 下拉选择项
key:'', // 是 string 32位唯一值
isAll:0, // 是 int 是否勾选全部 1是 0否
value:'', //否 string isAll=0时,必填,选中项id,多个逗号分隔
removeItems:'', //否 string isAll=1,取消选中项的id,多个逗号分隔
isClique:1
},
isIndeterminate: true,
rightHoverIndex:null,
rightTotal:0,
leftTotal:0,
defaultProps:{
id:'tagId',
label:'tagName',
children:'children'
}
}
},
created() {
this.getLeftList().then(_ => {
this.getRightList();
});
if (!this.isAdd) {
this.copyStoreWidget();
}
console.log(this.uuid,this.cacheUuid);
},
methods:{
// 拉取左侧数据
getLeftList() {
return new Promise((resolve,reject) => {
this.axios.get(baseUrl + '/api-plug/clique-tag-list?requestProject=gic-clique&search='+this.leftValue).then(res => {
this.leftList = res.data.result || [];
resolve();
// this.leftTotal = res.data.result.totalCount || 0;
}).catch(err => {
reject();
console.log(err)
})
})
},
// 拉取右侧数据
getRightList() {
let params = {
key:this.isCache ? this.cacheUuid : this.uuid,
selectType:2,
search:this.rightValue,
currentPage:1,
pageSize:999
}
this.axios.post(baseUrl + '/api-plug/list-right-data?requestProject=gic-clique',qs.stringify(params)).then(res => {
this.rightList = (res.data.result && res.data.result.result) || [];
this.rightTotal = (res.data.result && res.data.result.totalCount) || 0;
this.$nextTick(_ => {
this.$refs.tree.setCheckedKeys(this.rightList.map(v => v.id));
})
}).catch(err => {
console.log(err)
})
},
// 左侧数据移动到右侧
saveToRight() {
this.params.key = this.isAdd ? this.uuid: this.cacheUuid;
if (this.params.isAll) {
this.params.removeItems = this.leftList.filter(v => {
return this.leftCheckList.indexOf(v.tagId) < 0;
}).map(v => v.tagId).join(',');
} else {
this.params.value = this.$refs.tree.getCheckedKeys().join(',');
if (!this.params.value) {
this.$message({type:"warning",message:"门店标签不能为空"});
return;
}
}
this.axios.post(baseUrl + '/api-plug/save-store-widget?requestProject=gic-clique',qs.stringify(this.params)).then(res => {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
})
}).catch(err => {
console.log(err)
})
},
// 删除右侧全部
deleteRightAll() {
this.axios.get(baseUrl + '/api-plug/remove-allitems?requestProject=gic-clique&key=' + (this.isAdd ? this.uuid: this.cacheUuid)).then(res => {
if (res.data.errorCode === 0) {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
})
} else {
this.$message({type:'error',message:'清除全部失败'});
}
}).catch(err => {
console.log(err)
})
},
// 删除右侧单选或者多选数据
deleteRightItems(item) {
let params = {
key:this.isAdd ? this.uuid : this.cacheUuid,
removeItems:item || this.rightCheckList.join(',')
}
console.log(this.isAdd,this.uuid ,this.cacheUuid)
this.params.value = this.leftCheckList.join(',');
// console.log(url);
this.axios.post(baseUrl + '/api-plug/remove-items?requestProject=gic-clique',qs.stringify(params)).then(res => {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
this.rightCheckList = [];
})
}).catch(err => {
console.log(err)
})
},
// 选中所有数据
handleCheckAllChange(val) {
this.leftCheckList = val ? this.leftList.map(v => v.tagId) : [];
},
// 把老数据拷贝到新的临时id上
copyStoreWidget() {
this.axios.get(baseUrl + '/api-plug/copy-store-widget?requestProject=gic-clique&oldKey='+this.uuid+'&newKey='+this.cacheUuid).then(res => {
if(res.data.errorCode === 0) {
console.log('拷贝成功');
}
})
}
}
}
</script>
<template>
<el-popover class="vertical-baseline" placement="bottom-start" width="214" trigger="click" v-model="popoverShow">
<el-checkbox-group v-model="checkedList" @change="saveToRight">
<label :name="v.value" class="dm-store__type__item" v-for="(v,i) in typeList" :key="i">
<el-checkbox :label="v.value">{{v.label}}</el-checkbox>
</label>
</el-checkbox-group>
<div class="dm-store__line"></div>
<div class="el-input dm-store__reference w240" slot="reference">
<div class="el-input__inner dm-store__inputtag">
<el-tag v-for="(v,i) in checkedList" size="small" :key="i" closable @close="delItem(v)">{{filterLabel(v)}}</el-tag>
<span class="gray-color dm-store__inputtag--tips" v-show="checkedList.length === 0">请选择门店</span>
</div>
<el-popover placement="top-start" popper-class="select-shop__popper" width="300" trigger="hover">
<el-tag v-for="(v,i) in checkedList" class="dm-store__total--tag" size="small" :key="i" closable @close="delItem(v)">{{filterLabel(v)}}</el-tag>
<span slot="reference" class="dm-store__inputtag--total" v-show="checkedList.length">{{checkedList.length}}</span>
</el-popover>
</div>
<!-- 操作按钮 -->
<div class="dm-store__btn">
<el-button class="dm-store__btn--cancel" type="text" @click="popoverShow = false">确 定</el-button>
</div>
</el-popover>
</template>
<script>
import qs from 'qs';
import { baseUrl } from '../config';
export default {
name:'options-type',
props:{
uuid:{
type:String,
default:''
},
cacheUuid:{
type:String,
default:''
},
isAdd:{
type:Boolean,
default:true
},
isCache:{
type:Boolean,
default:false
}
},
created() {
this.getRightList();
if (!this.isAdd) {
this.copyStoreWidget();
}
console.log(this.uuid,this.cacheUuid);
},
data() {
return {
typeList:[
{label:'自营',value:'0'},
{label:'联营',value:'1'},
{label:'代理',value:'2'},
{label:'代销',value:'3'},
{label:'托管',value:'4'},
],
checkedList:[],
popoverShow:false,
params:{
selectType:1, // 是 int 下拉选择项
key:'', // 是 string 32位唯一值
isAll:0, // 是 int 是否勾选全部 1是 0否
value:'', //否 string isAll=0时,必填,选中项id,多个逗号分隔
removeItems:'', //否 string isAll=1,取消选中项的id,多个逗号分隔
isClique:1
},
}
},
methods:{
// label 的filter
filterLabel(val) {
let result = '';
this.typeList.map( v => {
if (val === v.value) {
result = v.label;
}
})
return result;
},
// 拉取右侧数据
getRightList() {
let params = {
key:this.isCache ? this.cacheUuid : this.uuid,
selectType:1,
search:'',
currentPage:1,
pageSize:20
}
this.axios.post(baseUrl + '/api-plug/list-right-data?requestProject=gic-clique',qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) {
this.checkedList = ((res.data.result && res.data.result.result) || []).map(v => v.id);
}
}).catch(err => {
console.log(err)
})
},
// 保存
saveToRight() {
this.params.key = this.isAdd ? this.uuid: this.cacheUuid;
this.params.value = this.checkedList.join(',');
if (!this.params.value) {
this.$message({type:"warning",message:"门店选择不能为空"});
return;
}
this.axios.post(baseUrl + '/api-plug/save-store-widget?requestProject=gic-clique',qs.stringify(this.params)).then(res => {
// 如果是编辑 并且有操作 把isCache设为true 最终保存是临时id
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
}).catch(err => {
console.log(err)
})
},
// 删除右侧单选或者多选数据
delItem(v) {
let params = {
key:this.isAdd ? this.uuid : this.cacheUuid,
removeItems:v,
value:''
}
console.log(this.isAdd,this.uuid ,this.cacheUuid)
this.axios.post(baseUrl + '/api-plug/remove-items?requestProject=gic-clique',qs.stringify(params)).then(res => {
if (!this.isAdd) {
this.$emit('update:isCache',true);
}
this.$nextTick(_ => {
this.getRightList();
})
}).catch(err => {
console.log(err)
})
},
// 把老数据拷贝到新的临时id上
copyStoreWidget() {
this.axios.get(baseUrl + '/api-plug/copy-store-widget?requestProject=gic-clique&oldKey='+this.uuid+'&newKey='+this.cacheUuid).then(res => {
if(res.data.errorCode === 0) {
console.log('拷贝成功');
}
})
}
}
}
</script>
{
"dependencies": {
"vue": "^2.5.11"
},
"description": "vue-gic-store-new Plugin",
"license": "MIT",
"main": "index.js",
"name": "@gic-test/vue-gic-store-new",
"private": false,
"version": "1.0.2"
}
# 链接工具组件
## 链接工具(弹窗版)
- 原svn: https://182.254.134.223/svn/gic/02.需求/gicProject/xcx/src/components/linktools/linktools.vue
```
<!--
/**
* 链接小工具组件(弹窗) by fairyly on 2018/06/15
* 组件调用
*/
<linktools :projectName="projectName" :linkToolsVisible="linkToolsVisible" :showType="showType" @linkSelect="linkSelect"/>
import Linktools from 'components/linktools/linktools.vue'
// 链接小工具参数
projectName: '', // 当前项目名
linkToolsVisible: false,
// 显示场景类型
showType: 0, ,插件默认0:显示全部 ; 1: (底部导航);2: (公众号菜单:只有小程序的,没有h5)
// methods
// linktools
// 显示事件
showLinkDialog() {
this.linkToolsVisible = true;
},
linkSelect(val) {
console.log(val)
// 关闭时隐藏
this.linkToolsVisible = false;
}
components: {
Linktools
}
-->
```
## 链接工具(页面内)
- 原svn: https://182.254.134.223/svn/gic/02.需求/gicProject/xcx/src/components/linktools/linktoolspage.vue
```
<!--
/**
* 链接小工具组件(页面内) by fairyly on 2018/06/15
* 组件调用
*/
<linktoolspage :projectName="projectName" ref="childlinktoolspage" v-if="menuForm.style=='4'" :linkToolsVisible="linkToolsVisible" :showType="showType" @linkSelect="linkSelect"/>
import Linktoolspage from 'components/linktools/linktoolspage.vue'
// 链接小工具参数
projectName: '', // 当前项目名
linkToolsVisible: false,
// 显示场景类型
showType: 0, ,插件默认0:显示全部 ; 1: (底部导航);2: (公众号菜单:只有小程序的,没有h5)
// methods
// linktools
showLinkDialog() {
this.linkToolsVisible = true;
},
// 使用页保存方法
saveInfo() {
var that = this;
// 父组件调用子组件方法
that.$refs.childlinktoolspage.confirmLinkSelect();
},
linkSelect(val) {
console.log(val)
// 关闭时隐藏
this.linkToolsVisible = false;
}
components: {
Linktools
}
-->
```
import qs from 'qs';
import axios from 'axios';
const host = window.location.origin;
const PREFIX = '/api-marketing/'
const PLUG_PREFIX = '/api-plug/'
// 加载最小时间
const MINI_TIME = 300
// 超时时间
let TIME_OUT_MAX = 20000
// 环境value
let _isDev = process.env.NODE_ENV === 'development'
// 请求接口host
let _apiHost = host.indexOf('localhost') !== -1 ? 'http://gicdev.demogic.com' : host
// 请求组(判断当前请求数)
let _requests = []
//创建一个请求实例
const instance = axios.create({
baseURL: _apiHost,
timeout: TIME_OUT_MAX,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
withCredentials: true // 允许携带cookie
})
/**
* 添加请求,显示loading
* @param {请求配置} config
*/
function pushRequest(config) {
console.log(`${config.url}--begin`)
_requests.push(config)
}
/**
* 移除请求,无请求时关闭loading
* @param {请求配置} config
*/
function popRequest(config) {
console.log(`${config.url}--end`)
let _index = _requests.findIndex(r => {
return r === config
})
if (_index > -1) {
_requests.splice(_index, 1)
}
}
/**
* 错误的处理
* @param {*} code
* @param {string} [message='请求错误']
*/
function handlerErr(code, message = '请求错误') {
switch (code) {
case 404:
message = '404,错误请求'
router.push('/404')
break;
case 401:
message = '登录失效'
break;
case 403:
message = '禁止访问'
router.push('/403')
break;
case 408:
message = '请求超时'
break;
case 500:
message = '服务器内部错误'
// router.push('/500')
break;
case 501:
message = '功能未实现'
break;
case 503:
message = '服务不可用'
break;
case 504:
message = '网关错误'
break;
}
this.$message({ type: 'warning', message: message })
}
/**
* 请求地址,请求数据,是否静默,请求方法
*/
const requests = (url, data = {}, contentTypeIsJSON = false, isSilence = false, method = 'POST') => {
let _opts = { method, url }
const _query = {}
let _timer = null
if (method.toLocaleUpperCase() === 'POST') {
if (contentTypeIsJSON) {
_opts.data = data;
_opts.headers = { 'Content-Type': 'application/json' };
_opts.url += '?requestProject=marketing';
} else {
_opts.data = qs.stringify(Object.assign({ requestProject: 'gic-web' }, data))
}
} else {
_opts.params = _query
}
return new Promise((resolve, reject) => {
let _random = { stamp: Date.now(), url: `${_apiHost + url}` }
if (!isSilence) {
_timer = setTimeout(() => {
pushRequest(_random)
}, MINI_TIME)
}
instance(_opts)
.then(res => {
clearTimeout(_timer)
popRequest(_random)
if (res.data.errorCode !== 0) {
reject(res);
handlerErr(res.data.errorCode, res.data.message);
} else {
resolve(res.data)
}
})
.catch(res => {
clearTimeout(_timer)
popRequest(_random)
if (res) {
handlerErr(res.response.status, '接口异常')
}
reject(res)
})
})
}
// 获取营销事件配置信息(类型, 最大条数)
export const getMarketingEvent = (params) => requests(PREFIX + 'get-marketing-event', params);
//素材库 图文 图文分页列表
export const loadImgTextList = (params) => requests(PREFIX + 'page-marketing-wechat-image-text', params);
//获取卡券列表
export const getCardList = (params) => requests(PLUG_PREFIX + 'get-coupon-list', params);
//素材库--图片--图片分页列表
export const loadImgList = (params) => requests(PREFIX + 'page-marketing-wechat-image', params);
//素材库--图片--编辑图片名称
export const updateImgName = (params) => requests(PREFIX + 'update-marketing-wechat-image-titlename', params);
//素材库--图片--新建图片分组
export const addGroupService = (params) => requests(PREFIX + 'save-marketing-wechat-image-group', params);
//素材库--图片--修改图片分组
export const updateGroupName = (params) => requests( PREFIX + 'update-marketing-wechat-image-group', params);
//素材库--图片--删除图片分组
export const deleteGroupService = (params) => requests( PREFIX + 'delete-marketing-wechat-image-group', params);
// 智能营销--ECM营销引擎-- 新建/修改 --回显营销事件类型详情
export const getMarketingTypeDetails = (params) => requests(PREFIX + 'get-marketing-type-details', params);
// 智能营销--新增/修改营销事件类型
export const saveUpdateMarketingType = (params) => requests(PREFIX + 'save-update-marketing-type', params);
// 智能营销 --删除营销事件
export const deleteMarketingType = (params) => requests(PREFIX + 'delete-marketing-Type', params);
//模板库--分页列表 (有效)
export const LoadTempList = (params) => requests(PREFIX + 'load-message-templateList', params);
"use strict";
exports.__esModule = true;
function _broadcast(componentName, eventName, params) {
this.$children.forEach(function (child) {
var name = child.$options.componentName;
if (name === componentName) {
child.$emit.apply(child, [eventName].concat(params));
} else {
_broadcast.apply(child, [componentName, eventName].concat([params]));
}
});
}
exports.default = {
methods: {
dispatch: function dispatch(componentName, eventName, params) {
var parent = this.$parent || this.$root;
var name = parent.$options.componentName;
while (parent && (!name || name !== componentName)) {
parent = parent.$parent;
if (parent) {
name = parent.$options.componentName;
}
}
if (parent) {
parent.$emit.apply(parent, [eventName].concat(params));
}
},
broadcast: function broadcast(componentName, eventName, params) {
_broadcast.call(this, componentName, eventName, params);
}
}
};
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg fill="#909399" class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M180.224 610.304c0 76.8-56.32 142.336-132.608 153.088v134.144h928.256v-134.144c-76.288-10.752-133.12-76.288-133.12-153.088s56.32-142.336 133.12-153.088V323.072H47.616v134.144c76.288 10.752 132.608 76.288 132.608 153.088zM3.584 477.696V300.544c0-6.144 2.048-11.264 6.656-15.872 4.096-4.096 9.728-6.656 15.872-6.656H998.4c6.144 0 11.264 2.048 15.872 6.656 4.096 4.096 6.656 9.728 6.656 15.872v176.64c0 6.144-2.048 11.264-6.656 15.872-4.096 4.096-9.728 6.656-15.872 6.656-60.928 0-110.592 49.664-110.592 110.592s49.664 110.592 110.592 110.592c6.144 0 11.264 2.048 15.872 6.656 4.096 4.096 6.656 9.728 6.656 15.872v176.64c0 6.144-2.048 11.264-6.656 15.872-4.096 4.096-9.728 6.656-15.872 6.656H25.6c-6.144 0-11.264-2.048-15.872-6.656-4.096-4.096-6.656-9.728-6.656-15.872v-176.64c0-6.144 2.048-11.264 6.656-15.872 4.096-4.096 9.728-6.656 15.872-6.656 60.928 0 110.592-49.664 110.592-110.592 0-60.928-49.664-110.592-110.592-110.592-6.144 0-11.264-2.048-15.872-6.656-4.096-4.096-6.144-9.728-6.144-15.36z m377.856-223.744c-11.776 3.072-24.064-4.096-27.136-15.872-3.072-11.776 4.096-24.064 15.872-27.136l467.968-124.928c11.776-3.072 24.064 4.096 27.136 15.872l26.112 98.304c3.072 11.776-4.096 24.064-15.872 27.136-11.776 3.072-24.064-4.096-27.136-15.872l-20.48-76.8-446.464 119.296zM666.112 389.12c0-12.288 9.728-22.016 22.016-22.016s22.016 9.728 22.016 22.016v88.576c0 12.288-9.728 22.016-22.016 22.016s-22.016-9.728-22.016-22.016V389.12z m0 176.64c0-12.288 9.728-22.016 22.016-22.016s22.016 9.728 22.016 22.016v88.576c0 12.288-9.728 22.016-22.016 22.016s-22.016-9.728-22.016-22.016v-88.576z m0 176.64c0-12.288 9.728-22.016 22.016-22.016s22.016 9.728 22.016 22.016v88.576c0 12.288-9.728 22.016-22.016 22.016s-22.016-9.728-22.016-22.016V742.4z" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="155.50px" viewBox="0 0 1317 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M438.857143 819.2 131.657143 512 29.257143 614.4 438.857143 1024 1316.571429 146.285714 1214.171429 43.885714Z" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" fill="#909399" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M913.903509 128.089283l-805.853631 0c-38.792515 0-70.352301 31.559786-70.352301 70.352301l0 626.775047c0 38.792515 31.559786 70.352301 70.352301 70.352301l805.853631 0c38.792515 0 70.352301-31.559786 70.352301-70.352301l0-626.775047C984.255811 159.64907 952.696024 128.089283 913.903509 128.089283zM108.049878 179.254593l805.853631 0c10.579963 0 19.186991 8.607028 19.186991 19.186991l0 321.058227-236.495272-236.496296c-27.431769-27.429723-72.062246-27.429723-99.494015 0L445.901583 434.20417l-53.064566-52.707432c-27.430746-27.430746-72.063269-27.430746-99.494015 0L88.862887 585.977875l0-387.53629C88.862887 187.861622 97.469915 179.254593 108.049878 179.254593zM913.903509 844.403622l-805.853631 0c-10.579963 0-19.186991-8.607028-19.186991-19.186991L88.862887 658.33688l240.660128-240.661152c7.480368-7.482415 19.653619-7.481392 27.195386 0.061398l322.30666 320.137251c4.990664 4.956895 11.510148 7.432273 18.027585 7.432273 6.576789 0 13.151531-2.520403 18.151405-7.554046 9.956769-10.024308 9.902534-26.222221-0.121773-36.178991L482.20337 470.261387l151.077857-151.077857c7.480368-7.480368 19.652596-7.482415 27.13501 0l272.675286 272.675286 0 233.357815C933.090501 835.796594 924.483472 844.403622 913.903509 844.403622z" /></svg>
\ No newline at end of file
<svg height="200" fill="#909399" viewBox="0 0 1024 1024" width="200" xmlns="http://www.w3.org/2000/svg"><path d="m893.686 171.345h-763.374c-55.326 0-100.6 45.272-100.6 100.601v526.064c0 55.328 45.272 100.603 100.6 100.603h763.374c55.328 0 100.603-45.274 100.603-100.603v-526.064c-.001-55.329-45.275-100.601-100.603-100.601m37.723 626.663c0 9.968-3.954 19.404-11.13 26.587-7.185 7.185-16.629 11.137-26.594 11.137h-763.373c-9.965 0-19.41-3.952-26.592-11.137-7.177-7.183-11.13-16.619-11.13-26.587v-526.062c0-9.967 3.954-19.412 11.13-26.594 7.182-7.175 16.626-11.131 26.592-11.131h763.374c9.965 0 19.412 3.956 26.594 11.131 7.178 7.182 11.133 16.628 11.133 26.594v526.062z"/><path d="m815.983 326.708-295.53 221.65-295.529-221.65c-13.883-10.416-33.594-7.6-44.01 6.288-10.417 13.893-7.603 33.597 6.287 44.013l314.394 235.797c.007.008.02.014.025.019.69.516 1.399 1.002 2.126 1.457.016.013.04.026.066.037a30.93 30.93 0 0 0 1.949 1.124c.15.076.294.152.444.227.666.341 1.338.666 2.028.954.126.056.254.096.378.148a35.8 35.8 0 0 0 1.682.624c.293.104.587.192.886.288.415.127.835.245 1.255.354.299.079.593.164.895.234.637.144 1.277.271 1.927.387.294.045.582.082.876.119.454.065.904.118 1.355.161.275.023.551.056.828.071.666.045 1.324.071 1.99.079.043 0 .085.006.127.006h.055c.04 0 .085-.006.127-.006a35.323 35.323 0 0 0 1.985-.079c.275-.016.553-.048.828-.071.457-.043.906-.096 1.361-.161.293-.037.582-.074.875-.119.648-.11 1.291-.24 1.934-.387.293-.07.59-.155.883-.234.42-.109.846-.228 1.261-.359.294-.091.587-.18.88-.283.572-.19 1.135-.399 1.693-.629.118-.048.245-.088.367-.144.689-.288 1.361-.61 2.033-.954.15-.071.293-.147.443-.227.654-.35 1.301-.715 1.938-1.111l.085-.056a31.568 31.568 0 0 0 2.104-1.443.105.105 0 0 1 .037-.024l314.396-235.797c13.889-10.417 16.702-30.123 6.279-44.012-10.419-13.886-30.121-16.707-44.013-6.291"/></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" fill="#909399" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M903.9 916.4H123.4c-61.2 0-111.1-49.8-111.1-111.1V219.7c0-61.2 49.8-111.1 111.1-111.1h780.5c61.2 0 111.1 49.8 111.1 111.1v585.6c0 61.3-49.8 111.1-111.1 111.1zM123.4 169.2c-27.8 0-50.5 22.6-50.5 50.5v585.6c0 27.8 22.6 50.5 50.5 50.5h780.5c27.8 0 50.5-22.6 50.5-50.5V219.7c0-27.8-22.6-50.5-50.5-50.5H123.4z" /><path d="M327.1 591.6H213c-39 0-70.7-31.7-70.7-70.7V341.8c0-39 31.7-70.7 70.7-70.7h114.1c39 0 70.7 31.7 70.7 70.7v179.1c0 39-31.7 70.7-70.7 70.7zM213 331.7c-5.5 0-10.1 4.6-10.1 10.1v179.1c0 5.5 4.6 10.1 10.1 10.1h114.1c5.5 0 10.1-4.6 10.1-10.1V341.8c0-5.5-4.6-10.1-10.1-10.1H213z" /><path d="M172.6 723.7h649.7" /><path d="M822.3 754H172.6c-16.7 0-30.3-13.6-30.3-30.3s13.6-30.3 30.3-30.3h649.7c16.7 0 30.3 13.6 30.3 30.3S839 754 822.3 754z" /><path d="M562.4 528.8h259.9" /><path d="M822.3 559.1H562.4c-16.7 0-30.3-13.6-30.3-30.3s13.6-30.3 30.3-30.3h259.9c16.7 0 30.3 13.6 30.3 30.3s-13.6 30.3-30.3 30.3z" /><path d="M562.4 333.9h259.9" /><path d="M822.3 364.2H562.4c-16.7 0-30.3-13.6-30.3-30.3s13.6-30.3 30.3-30.3h259.9c16.7 0 30.3 13.6 30.3 30.3s-13.6 30.3-30.3 30.3z" /></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" fill="#909399" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M762.8 1024l-5.6-0.1c-125.5-6.4-290.5-119.2-442.2-301.8l-54-64.9C106.7 471.6 29.5 294.9 49.1 172.3 64.9 74 199.1 0 278.4 0c51.1 0 71.1 29.2 77.8 43.7 37.2 66.2 88.6 189 88.9 241l0.1 9-3.3 8.5c-12.4 32.6-39.7 48-57.8 58.2-16.4 9.2-18.8 11.3-19.5 15.6 2 6.6 15.2 40.1 94.8 137.8l41.1 49.3c80.8 94.9 110.8 113.2 116.4 116 5.1 0.5 7.7-1 21-15.5 13.9-15.2 34.9-38.1 70-43.2l8.7-1.2 8.4 1.8c51.6 10.8 164.6 85.7 223.9 135.2 21.5 15.3 38.4 48.3 23.1 96.5-22.3 69.7-114.9 171.3-209.2 171.3zM278.4 63.6c-54.1 0-156.8 58.7-166.4 118.7-16.3 101.4 59.6 267.8 197.9 434.2l54 64.9C502.4 848.1 654 954.9 759.4 960.3h3.6c59.6-0.2 132.3-77 148.3-127.2 5.4-16.9 2.3-24 0.6-25.3l-2.8-2.1c-61.2-51.3-159.1-112.5-194.6-122-10.6 2.4-18.4 10.4-29.7 22.8-15.9 17.3-37.7 41.1-78.9 35.3-11.5-1.6-41.9-5.9-154.1-137.8l-41.5-49.8C298.1 416.6 300 387 300.8 374.3c2.7-41.7 30-57 51.9-69.3 14.5-8.1 24-14 28.6-23.1-2.6-36-43.8-142-81.3-208.2l-1.6-3.1c-2.6-6.3-14.9-7-20-7z m339.4 615.9zM364.2 374.7z" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" fill="#909399" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M170.496 179.2h683.52v106.496h-683.52z" /><path d="M458.752 179.2h106.496v683.52h-106.496z" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M511.858139 0.60441c-282.494127 0-511.500488 229.006361-511.500488 511.500488s229.006361 511.500488 511.500488 511.500487 511.500488-229.006361 511.500487-511.500487a511.500488 511.500488 0 0 0-511.500487-511.500488z m256.466544 459.737038a151.813744 151.813744 0 0 1-87.262783 65.675863 83.16978 83.16978 0 0 1-24.449123 4.092004c-16.045331 0-29.053627-13.007298-29.053628-29.052628s13.007298-29.053627 29.053628-29.053627c2.210841 0.05095 4.407696-0.367641 6.444706-1.227801a91.353787 91.353787 0 0 0 55.855454-40.920039 75.190572 75.190572 0 0 0 11.049209-39.589339c0-45.933143-42.45454-83.78418-94.21799-83.78418a105.1643 105.1643 0 0 0-51.150049 13.400914 81.840078 81.840078 0 0 0-43.68334 70.383266V634.250615c-0.516496 50.330849-28.33433 96.405854-72.633069 120.304515a159.486252 159.486252 0 0 1-79.692176 20.460019c-84.294681 0-153.450146-63.42606-153.450146-141.890435a136.05913 136.05913 0 0 1 19.744718-69.768866 151.813744 151.813744 0 0 1 87.261783-65.675864 85.830181 85.830181 0 0 1 24.450123-4.092004c16.045331 0 29.052628 13.007298 29.052628 29.052629 0 16.04633-13.007298 29.053627-29.052628 29.053627a15.651715 15.651715 0 0 0-6.444706 1.227801 95.855391 95.855391 0 0 0-55.855454 40.920039 75.190572 75.190572 0 0 0-11.04921 39.589339c0 45.933143 42.45454 83.78418 94.83239 83.784179a105.1643 105.1643 0 0 0 51.150049-13.400913 81.840078 81.840078 0 0 0 43.579442-70.383266V390.572581c0.566447-50.37081 28.413253-96.468792 72.735969-120.407414a151.097444 151.097444 0 0 1 79.077776-21.483021c84.294681 0 153.450146 63.42606 153.450146 141.890435a136.05913 136.05913 0 0 1-19.743719 69.768867z" fill="#24AF41" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" fill="#909399" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M691.198707 135.809293c121.069899 0 219.59499 91.010586 219.59499 203.733333 0 35.069414-10.016323 69.302303-28.387556 100.196849-27.552323 45.08703-71.801535 78.491152-125.240888 94.354101-14.197657 4.172283-25.051798 5.845333-35.069415 5.845333-23.378747 0-41.74998-18.368646-41.749979-41.748687s18.371232-41.751273 41.749979-41.751273c1.664 0 5.008808 0 9.182384-1.664 35.905939-10.025374 64.293495-30.895838 80.155152-58.455919 10.860606-17.533414 15.869414-36.732121 15.869414-56.775111 0-65.966545-60.956444-120.233374-135.267556-120.233374-25.885737 0-50.937535 6.681859-73.48105 19.198708-39.24299 22.552566-62.621737 60.121212-62.621738 101.035959v349.862788c0 70.963717-39.241697 136.092444-104.370424 172.833616-35.068121 20.04299-74.317576 30.060606-114.395798 30.060606C216.096323 892.302222 117.569939 801.286465 117.569939 688.571475c0-35.070707 10.017616-69.308768 28.388849-100.199435 27.549737-45.094788 71.808-78.491152 125.248646-94.352808 15.026424-4.173576 25.04404-5.84404 35.069414-5.84404 23.38004 0 41.742222 18.369939 41.742223 41.748687s-18.362182 41.74998-41.742223 41.74998c-1.671758 0-5.017859 0-9.190141 1.664-35.904646 10.854141-64.293495 31.734949-80.153859 58.448161-10.854141 17.536-15.862949 36.743758-15.862949 56.785455 0 65.956202 60.947394 120.230788 136.096323 120.230788 25.885737 0 50.937535-6.67798 73.481051-19.205172 39.241697-22.542222 62.621737-60.112162 62.621737-101.025616V339.542626c0-70.975354 39.241697-136.104081 104.370424-172.834909 34.231596-20.880808 73.481051-30.898424 113.559273-30.898424zM34.909091 512.466747" /></svg>
\ No newline at end of file
/* reset样式 */
.w100 {
width: 100px;
}
.w200 {
width: 200px;
}
.w240 {
width: 240px;
}
.w400{
width: 400px;
}
.w500{
width: 500px;
}
.inline-block {
vertical-align: middle;
display:inline-block!important;
}
.block{
display: block!important;
}
.gray-color,.gray{
color:#909399;
}
.pb22 {
padding-bottom:22px;
}
.pb10 {
padding-bottom:10px;
}
.pl20 {
padding-left: 20px;
}
.pl10{
padding-left:10px;
}
.pr10{
padding-right:10px;
}
.fz13 {
font-size: 13px;
}
.fz12 {
font-size: 12px;
}
.fl {
float: left;
}
.fr {
float: right;
}
.clearfix:after{
display: block;
clear: both;
content: '';
visibility: hidden;
height: 0;
}
.clearfix{
zoom: 1;
}
.vertical-middle {
vertical-align: middle;
}
.block{
display: block;
overflow: hidden;
}
.ellipsis{
max-height:20px;
line-height:20px;
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient:vertical
}
.ellipsis-l2{
max-height:40px;
line-height:20px;
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:2;
-webkit-box-orient:vertical
}
.ellipsis-l3{
max-height:60px;
line-height:20px;
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:3;
-webkit-box-orient:vertical
}
.blue {
color: #1890ff;
cursor: pointer;
}
.label-hidden .el-checkbox__label, .label-hidden .el-radio__label {
opacity: 0;
position: absolute;
}
.dm-pagination {
text-align: right;
margin: 24px 0 10px 0;
}
.text-left {
text-align: left;
}
/* reset样式end */
.dm-marketing__opt{
background: #FFFFFF;
border: 1px solid rgba(235,238,245,1);
box-shadow: 0px 1px 20px 0px rgba(0,0,0,0.15);
padding:0 20px;
}
.dm-marketing__opt--label{
vertical-align: middle;
color:#303133;
font-size:14px;
}
.dm-marketing__opt--icon,.dm-marketing__opt--icon--bottom {
display:inline-block;
font-size:20px;
padding:8px;
margin:0 10px;
color:#909399;
border:1px solid #E4E7ED;
border-radius:50%;
vertical-align: middle;
cursor: pointer;
}
.dm-marketing__opt--icon:hover,.dm-marketing__opt--icon--bottom:hover {
color:#1890ff;
border:1px solid #1890ff;
}
.dm-marketing__opt--icon.el-icon-delete:hover {
color:#f56c6c;
border:1px solid #f56c6c;
}
.dm-marketing__opt--icon--bottom{
margin:20px 0 0 60px;
}
.dm-marketing__opt__item {
display:inline-block;
height:36px;
line-height:36px;
margin-right:30px;
cursor: pointer;
}
.dm-marketing__opt__item > img {
vertical-align: middle;
height: 17px;
width: auto;
color: #909399;
}
.dm-marketing__opt__item > span {
vertical-align: middle;
color: #606266;
font-size:14px;
}
.dm-marketing__content--label{
position: relative;
top: 40px;
left: 0;
}
.dm-marketing__content--wrap{
margin-top:30px;
max-width:1200px;
}
.dm-marketing__content{
margin-left:70px;
}
.dm-marketing__content__item{
padding: 20px 0 0 0;
min-width: 950px;
}
.dm-marketing__content__item::after {
content: '';
height: 1px;
width: 100%;
background: #E4E7ED;
display: block;
margin-left: 48px;
margin-top: 20px;
}
.dm-marketing__content--index{
display:inline-block;
width:24px;
height:24px;
line-height:24px;
text-align:center;
vertical-align:middle;
border:1px solid #E4E7ED;
border-radius:50%;
padding:4px;
color:#606266;
}
/* item */
.dm-imgText__item__wrap{
display: inline-block;
position: relative;
width: 320px;
/* height: 290px; */
margin:0 10px;
vertical-align: middle;
background: #fff;
border:1px solid #E4E7ED;
border-radius:4px;
box-shadow: 0px 2px 8px 0px rgba(0,0,0,0.10);
}
.dm-imgText__item__mask{
position: absolute;
top: 0;
left: 0;
width: 320px;
height: 100%;
border-radius:4px;
background: rgba(0,0,0,0.5);
text-align: center;
color: #fff;
line-height: 290px;
cursor: pointer;
z-index:9;
}
.dm-imgText__item__other__mask {
position: absolute;
top: 0;
left: 0;
width: 320px;
height: 100%;
border-radius:4px;
background: rgba(0,0,0,0.5);
text-align: center;
color: #fff;
line-height: 90px;
cursor: pointer;
z-index:9;
}
.dm-imgText__item{
position: relative;
padding:15px;
}
.dm-imgText__item > img{
display: inline-block;
width: 290px;
height: 163px;
margin: 20px 0 20px;
}
.dm-imgText__item__other{
position: relative;
border-top: 1px solid #E4E7ED;
padding:15px;
}
.dm-imgText__item__other > img{
float: left;
width: 60px;
height: 60px;
margin-right: 10px;
}
.dm-imgText__item__other > p{
float: left;
width: 210px;
}
.dm-text__wrap{
width: 500px;
margin-left: 10px;
}
.dm-image__item__wrap{
display: inline-block;
margin-left: 10px;
vertical-align: middle;
text-align: center;
/* width: 180px; */
height: 122px;
border: 1px solid rgba(228,231,237,1);
border-radius: 2px;
}
.dm-image__item__wrap > img {
width: auto;
height: 100%;
}
.dm-wxa__item__wrap{
display: inline-block;
position: relative;
width: 320px;
height: 347px;
margin:0 10px;
vertical-align: middle;
background: #fff;
border:1px solid #E4E7ED;
border-radius:4px;
box-shadow: 0px 2px 8px 0px rgba(0,0,0,0.10);
}
.dm-wxa__item{
padding:15px;
}
.dm-wxa__avatar {
padding-bottom:15px;
}
.dm-wxa__avatar > img {
width: 50px;
height: 50px;
border-radius: 50%;
vertical-align: middle;
}
.dm-wxa__avatar > span {
vertical-align: middle;
max-width: 100px;
line-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
}
.dm-wxa__item > img{
display: inline-block;
width: 290px;
height: 163px;
margin: 20px 0 15px;
}
.dm-wxa__item--bottom > img {
width: 14px;
height: 14px;
vertical-align: middle;
}
.dm-wxa__item--bottom > span {
vertical-align: middle;
color: #909399;
font-size: 12px;
}
/* card */
.dm-card__item__wrap{
display: inline-block;
position: relative;
width: 298px;
height: 142px;
margin:0 10px;
vertical-align: middle;
border: 1px solid rgba(228,231,237,1);
border-radius: 4px;
}
.dm-card__item {
padding:0 15px;
background: rgba(72,170,3,0.85);
height:106px;
line-height: 106px;
}
.dm-card__item__avatar {
width: 60px;
height: 60px;
border-radius: 50%;
vertical-align: middle;
}
.dm-card__item__title {
vertical-align: middle;
margin-left: 8px;
max-width: 200px;
font-size: 16px;
font-weight: 500;
line-height: 30px;
color: #fff;
overflow: hidden;
text-overflow: ellipsis;
}
.dm-card__item__desc{
vertical-align: middle;
margin-left: 8px;
max-width: 200px;
font-size: 12px;
line-height: 20px;
color: #fff;
overflow: hidden;
text-overflow: ellipsis;
}
.dm-card__item--bottom {
vertical-align: middle;
line-height: 106px;
color: #909399;
font-size: 12px;
line-height: 36px;
padding-left: 15px;
}
/* teltask message */
.dm-message__item__wrap,.dm-teltask__item__wrap{
width: 760px;
height: 94px;
margin:0 10px;
border: 1px solid rgba(228,231,237,1);
border-radius: 4px;
display: inline-block;
vertical-align: middle;
}
.dm-message__item,.dm-teltask__item{
padding: 15px;
display: inline-block;
vertical-align: middle;
}
.dm-message__item--title,.dm-teltask__item--title {
font-size: 16px;
max-height: 36px;
line-height: 36px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.dm-message__item--content,.dm-teltask__item--content {
font-size: 14px;
color: #606266;
max-height: 30px;
line-height: 30px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
/**
* 补零
* @param {String/Number} num
*/
export const fillZero = (num) => {
num = num * 1;
if (num < 10) {
return '0' + num;
} else {
return num;
}
}
/**
* @param {*时间} date
* @param {*转换的格式} type
*/
export const formateDateTimeByType = (date, type = 'yyyy-MM-dd-HH-mm-ss') => {
if (!date){return ''}
if (typeof date === 'number') {
date = new Date(date);
}
if (typeof date === 'string') {
return date
} else {
var year = type.indexOf('yyyy') >= 0 ? (fillZero(date.getFullYear())) : '';
var month = type.indexOf('MM') >= 0 ? ('-' + fillZero(date.getMonth() + 1)) : '';
var day = type.indexOf('dd') >= 0 ? ('-' + fillZero(date.getDate())+'') : '';
var hours = type.indexOf('HH') >= 0 ? (' ' + fillZero(date.getHours())) : '';
var min = type.indexOf('mm') >= 0 ? (':' + fillZero(date.getMinutes())) : '';
var sec = type.indexOf('ss') >= 0 ? (':' + fillZero(date.getSeconds())) : '';
// console.log(year+month+day+hours+min+sec);
return year + month + day + hours + min + sec;
}
}
/*
* 限制字数用, 一个汉字算一个字,两个英文/字母算一个字
*/
export const getByteVal = (val, max) =>{
var returnValue = '';
var byteValLen = 0;
for (var i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null)
byteValLen += 1;
else
byteValLen += 0.5;
if (byteValLen > max)
break;
returnValue += val[i];
}
return returnValue;
};
/*
* 一个汉字算一个字,一个英文字母或数字算半个字
*/
export const getZhLen = (val) => {
var len = 0;
for (var i = 0; i < val.length; i++) {
var a = val.charAt(i);
if (a.match(/[^\x00-\xff]/ig) != null) {
len += 1;
}
else {
len += 0.5;
}
}
return Math.ceil(len);
};
/*
* 一个汉字算一个字,两个英文/字母算一个字
*/
export const getByteVal2 = (val) => {
var returnValue = '';
var byteValLen = 0;
for (var i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null)
byteValLen += 1;
else
byteValLen += 0.5;
returnValue += val[i];
}
return returnValue;
}
<template>
<el-popover class="el-button el-button--text"
placement="top"
width="160"
v-model="visible">
<p style="line-height:1.5;padding:10px 10px 20px;color:#606266;">{{tips}}</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="cancel">取消</el-button>
<el-button type="primary" size="mini" @click="confirm">确定</el-button>
</div>
<span slot="reference"><slot></slot></span>
</el-popover>
</template>
<script>
export default {
name:'dm-delete',
props:{
tips:{
type:String,
default:'是否删除?'
},
},
data() {
return {
visible: false,
};
},
methods:{
cancel() {
this.visible = false
},
confirm() {
this.visible = false
this.$emit('confirm')
}
}
}
</script>
<template>
<div class="dm-input" :class="{'disabled':disabled}">
<el-input
ref="elInput"
v-model="currentValue"
:placeholder="placeholder"
:size="size"
:resize="resize"
:name="name"
:form="form"
:id="id"
:maxlength="maxlength"
:minlength="minlength"
:readonly="readonly"
:autofocus="autofocus"
:disabled="disabled"
:type="type"
:autosize="autosize"
:rows="rows"
:autoComplete="autoComplete"
:max="max"
:min="min"
:step="step"
:validateEvent="validateEvent"
:suffixIcon="suffixIcon"
:prefixIcon="prefixIcon"
:label="label"
:clearable="clearable"
:tabindex="tabindex"></el-input>
<div class="dm-input__counter" :class="{'text-area':type === 'textarea'}">
<div class="dm-input__counter--inner">
<span class="cur">{{currentValue.length}}</span>
<span class="split"> / </span>
<span class="max">{{maxlength||0}}</span>
</div>
</div>
</div>
</template>
<script>
import emitter from '../assets/emitter.js';
export default {
name: 'dm-input',
props: {
// 自定义属性
// maxLength: Number,
// 原生属性
value: [String, Number],
placeholder: String,
size: String,
resize: String,
name: String,
form: String,
id: String,
maxlength: Number,
minlength: Number,
readonly: Boolean,
autofocus: Boolean,
disabled: Boolean,
type: {
type: String,
default: 'text'
},
autosize: {
type: [Boolean, Object],
default: false
},
rows: {
type: Number,
default: 2
},
autoComplete: {
type: String,
default: 'off'
},
max: {},
min: {},
step: {},
validateEvent: {
type: Boolean,
default: true
},
suffixIcon: String,
prefixIcon: String,
label: String,
clearable: {
type: Boolean,
default: false
},
tabindex: String
},
data() {
return {
currentValue: this.value,
};
},
// computed: {
// readonly() {
// return this.currentValue.length >= this.maxlength;
// }
// },
watch: {
value(val) {
if (val !== this.currentValue) {
this.currentValue = val;
}
},
currentValue(val) {
let value = '';
if (val.length > this.maxlength) {
value = val.slice(0, maxlength - 1);
} else {
value = val;
}
this.$emit('input', value);
this.dispatch('ElFormItem', 'el.form.change', [val]);
}
},
mixins: [emitter],
}
</script>
<style lang="scss" scoped>
.dm-input {
display: inline-block;
background: #fff;
width: 100%;
position: relative;
&.disabled {
background: #f5f7fa;
}
&__counter {
position: absolute;
bottom: 1px;
right: 10px;
height: 28px;
line-height: 12px;
font-size: 12px;
background: inherit;
opacity: 0.9;
&--inner{
display: flex;
align-items: center;
height: 100%;
& > span {
color:#909399;
}
}
}
&__counter.text-area {
bottom: -20px;
height: 20px;
right: 0;
}
}
</style>
<template>
<div class="dm-card__item__wrap">
<div class="dm-card__item" :style="{background:item.cardColor}">
<img class="dm-card__item__avatar" :src="item.brandLogo || loadErrorImg" alt="">
<div class="inline-block">
<p class="dm-card__item__title">{{item.cardName}}</p>
<p class="dm-card__item__desc" v-if="item.cardEffectiveMode !== 0">领取后第{{item.startDay+1}}-{{item.limitDay+item.startDay}}</p>
<p class="dm-card__item__desc" v-if="item.cardEffectiveMode === 0">{{formateDateTimeByType(item.beginDate,'yyyy-MM-dd')}}{{formateDateTimeByType(item.endDate,'yyyy-MM-dd')}}</p>
</div>
</div>
<p class="dm-card__item--bottom">
<span>适用{{item.storeMode === 0 ? "所有门店" : (item.storeMode === 1 ? "部分分组" : "部分门店")}}</span>
</p>
</div>
</template>
<script>
import {formateDateTimeByType} from '../assets/utils.js'
export default {
name:'item-card',
data(){
return {
formateDateTimeByType,
loadErrorImg:require('../assets/img/loaderror.png')
}
},
props:{
item:{
type: Object,
default() {
return {}
}
}
}
}
</script>
<template>
<span class="dm-image__item__wrap">
<img :src="item.qcloudImageUrl || loadErrorImg" alt="">
</span>
</template>
<script>
export default {
name: 'item-image',
props: {
item: {
type: Object,
default() {
return {}
}
}
},
data() {
return {
loadErrorImg:require('../assets/img/loaderror.png')
}
}
}
</script>
<template>
<span class="dm-message__item__wrap">
<div class="dm-message__item">
<p class="dm-message__item--title">{{item.title}}</p>
<p class="dm-message__item--content">{{item.content}}</p>
</div>
</span>
</template>
<script>
export default {
name: 'item-message',
props: {
item: {
type: Object,
default() {
return {}
}
}
}
}
</script>
<template>
<div class="dm-imgText__item__wrap" >
<div v-for="(v,i) in item.itemList" :key="i">
<div class="dm-imgText__item" v-if="i === 0" @mouseover="itemMouseover(v)" @mouseout="itemMouseout(v)">
<div class="dm-imgText__item__mask" v-if="v.maskShow" @click="preview(v)">预览文章</div>
<p class="ellipsis-l2">{{v.titleName}}</p>
<img :src="v.qcloudImageUrl || loadErrorImg" alt="" srcset="">
<p class="ellipsis fz13 gray-color">{{v.remark}}</p>
</div>
<div class="dm-imgText__item__other clearfix" v-else @mouseover="itemMouseover(v)" @mouseout="itemMouseout(v)">
<div v-if="v.maskShow" class="dm-imgText__item__other__mask" @click="preview(v)">预览文章</div>
<img :src="v.qcloudImageUrl || loadErrorImg" alt="" srcset="">
<p class="ellipsis-l2">{{v.titleName}}</p>
</div>
</div>
</div>
</template>
<script>
export default {
name:'item-teletext',
data(){
return {
maskShow:false,
loadErrorImg:require('../assets/img/loaderror.png')
}
},
props:{
item:{
type: Object,
default() {
return {
itemList:[]
}
}
}
},
created() {
if (this.item.itemList instanceof Array) {
this.item.itemList.forEach((v,i) => {
this.$set(this.item.itemList,i,{...v,maskShow:false})
})
}
},
methods:{
preview(item) {
window.open(item.mediaUrl);
},
itemMouseover(item) {
item.maskShow = true;
},
itemMouseout(item) {
item.maskShow = false;
}
}
}
</script>
<template>
<span class="dm-teltask__item__wrap">
<div class="dm-teltask__item">
<p class="dm-teltask__item--title">{{item.title}} <span class="fz13 gray-color">任务逾期判定{{item.lateDays}}天之后</span></p>
<p class="dm-teltask__item--content">{{item.content}}</p>
</div>
</span>
</template>
<script>
export default {
name: 'item-teltask',
props: {
item: {
type: Object,
default() {
return {}
}
}
}
}
</script>
<template>
<span class="dm-text__wrap ellipsis-l2 inline-block" v-html="item.content"></span>
</template>
<script>
export default {
name: 'item-text',
props: {
item: {
type: Object,
default() {
return {}
}
}
}
}
</script>
<template>
<div class="dm-wxa__item__wrap" @mouseover="maskShow = true" @mouseout="maskShow = false">
<div class="dm-wxa__item">
<div class="dm-wxa__avatar">
<img :src="item.brandLogo || loadErrorImg" alt="">
<span>{{item.brandName}}</span>
</div>
<p class="ellipsis-l2">{{item.title}}</p>
<img :src="item.imageUrl || loadErrorImg" alt="" srcset="">
<p class="dm-wxa__item--bottom"><img src="../assets/img/wxa-circle.svg" alt="" srcset=""><span> 小程序</span></p>
</div>
</div>
</template>
<script>
export default {
name:'item-wxa',
data(){
return {
maskShow:false,
loadErrorImg:require('../assets/img/loaderror.png')
}
},
props:{
item:{
type: Object,
default() {
return {}
}
}
}
}
</script>
<template>
<el-dialog title="选择卡券" :visible.sync="show" width="800px" :before-close="close">
<div class="clearfix pb22">
<div class="fl">
<span>{{total}}</span>
<el-input v-model="listParams.searchParam" class="w200" clearable placeholder="请输入卡券名称" @change="refresh"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input>
<span class="fz12 gray pl20">{{limitTips}} </span>
</div>
<div class="fr">
<el-button type="primary" @click="add">新建卡券</el-button>
<el-button @click="refresh">刷新列表</el-button>
</div>
</div>
<el-table tooltipEffect="light" :data="tableList" :height="360" row-class-name="cursor-pointer" style="width: 100%" v-loading="loading" @row-click="rowClick">
<el-table-column :show-overflow-tooltip="false" width="60" align="center" prop="coupCardId">
<template slot-scope="scope">
<div class="sms-record_left label-hidden">
<el-radio v-model="selectedData" :label="scope.row" class="pr10"></el-radio>
</div>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="false" align="left" prop="cardName" label="卡券名称"></el-table-column>
<el-table-column :show-overflow-tooltip="false" :width="100" align="left" prop="cardLimit" label="领取限制"></el-table-column>
<el-table-column :show-overflow-tooltip="false" :width="120" align="left" prop="storeMode" label="适用门店">
<template slot-scope="scope">
{{scope.row.storeMode === 0?'所有门店':(scope.row.storeMode === 1?'部分分组':'部分门店')}}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="false" :width="100" align="left" prop="couponStock" label="库存"></el-table-column>
<el-table-column :show-overflow-tooltip="true" align="left" prop="subName" label="描述"></el-table-column>
</el-table>
<el-pagination v-show="tableList.length" class="dm-pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="listParams.pageSize" layout="prev, pager, next" :total="total"></el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="close">关 闭</el-button>
<el-button type="primary" @click="addItem">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import {getCardList} from '../assets/api.js';
export default {
name:'lib-card',
props:{
show:{
type:Boolean,
default:false
},
cardLimitType:{
type:Number,
default:1
}
},
computed:{
limitTips() {
if (this.cardLimitType === 2) {
return '领取限制领取1~100的卡券,系统已过滤,符合条件共';
} else if (this.cardLimitType === 3) {
return '领取限制领取<100的卡券不支持选择,系统已过滤,符合条件共';
} else {
return '领取限制>1的卡券不支持选择,系统已过滤,符合条件共';
}
}
},
data(){
return{
listParams:{
searchParam:'',
currentPage:1,
pageSize:10,
requestProject:'gic-web',
cardLimitType:this.cardLimitType,
cardType:''
},
total:0,
tableList:[],
selectedData:{}
}
},
created(){
this.getCardList();
},
methods:{
handleSizeChange(val) {
this.listParams.pageSize = val;
this.getCardList();
},
handleCurrentChange(val) {
this.listParams.currentPage = val;
this.getCardList();
},
getCardList() {
this.loading = true;
getCardList(this.listParams).then(res => {
if (res.errorCode === 0) {
this.tableList = res.result.result || [];
this.total = res.result.totalCount;
}
this.loading = false;
})
},
reset() {
this.listParams.searchParams = '';
this.getCardList();
},
close() {
this.$emit('update:show',false);
},
rowClick(row) {
row.comName = 'card';
this.selectedData = row;
},
addItem() {
if (!this.selectedData.comName) {
this.$message({type:'warning',message:'未选择卡券'});
return;
}
this.$emit('sendItem',this.selectedData);
this.close();
},
add() {
window.open('/marketing/#/card/add');
},
refresh() {
this.listParams.currentPage = 1;
this.getCardList();
}
}
}
</script>
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