Authored by 陈峰

editor-safe

<template>
<editor v-bind="$attrs" v-on="$listeners"></editor>
</template>
<script>
import xss from 'util/xss';
export default {
name: 'editor-safe',
created() {
this.$listeners.change = this.change;
},
methods: {
change(val) {
let currentVal = val;
val = xss.replaceScript(val);
this.$emit('change', val);
if (currentVal !== val) {
this.value = val;
this.$Message.error('输入内容有敏感字符,已自动清除');
}
}
}
};
</script>
<style>
</style>
import Editor from './editor';
import EditorSafe from './editor-safe';
export {
Editor,
EditorSafe
Editor
};
... ...
... ... @@ -9,7 +9,7 @@ import LayoutTab from './layout-tab';
import LayoutFilter from './layout-filter';
import LayoutPrint from './layout-print';
import ActionGroup from './action-group';
import {Editor, EditorSafe} from './editor';
import {Editor} from './editor';
import FileUpload from './file-upload';
import DragFileUpload from './drag-file-upload';
import IFrame from './iframe';
... ... @@ -28,7 +28,6 @@ export default {
LayoutPrint,
ActionGroup,
Editor,
EditorSafe,
FileUpload,
DragFileUpload,
IFrame,
... ...
... ... @@ -19,7 +19,7 @@
</template>
<script>
import cache from 'cache';
import cache from 'util/cache';
export default {
name: 'layout',
... ...
... ... @@ -118,7 +118,7 @@
<Row>
<Col>
<editor-safe :content="desc" :z-index="2" @change="updateProductDesc"></editor-safe>
<editor :content="desc" :z-index="2" @change="updateProductDesc"></editor>
</Col>
</Row>
... ... @@ -218,7 +218,7 @@
</template>
<script>
import xss from 'xss';
import ProductCreateService from 'services/product/product-create-service';
import {step3} from '../store';
... ... @@ -272,7 +272,7 @@ export default {
let result = {
productSkn: this.product.productSkn,
id: this.product.productId,
productIntro: this.desc,
productIntro: xss(this.desc),
goodsImagesReqStr: JSON.stringify(this.handleImage()),
productStandardRelationStr: JSON.stringify(this.handleRelation()),
attributeProValuesOne: JSON.stringify(this.handleOne()),
... ...
... ... @@ -81,9 +81,9 @@
<div class="create-item-title">商品描述
<span class="create-group-sub-title">(详情页内容)</span>
</div>
<editor-safe :content="product.productIntro"
<editor :content="product.productIntro"
@change="updateProductDesc"
:z-index="2"></editor-safe>
:z-index="2"></editor>
<div class="create-item-title">商品属性
<span class="create-group-sub-title">(请认真选择所列的属性项,所填内容会对商品搜索、智能推荐等功能产生影响,从而影响商品曝光展示)</span>
</div>
... ... @@ -120,7 +120,7 @@
</template>
<script>
import _ from 'lodash';
import xss from 'xss';
import ProductCreateService from 'services/product/product-create-service';
import ProductService from 'services/product/product-service';
import {edit} from './store';
... ... @@ -496,7 +496,7 @@ export default {
newProduct.attributeProValuesTwo =
JSON.stringify(this.productCreateService.handleValue(this.product.productSkn, this.model.attributeProValuesTwo));
newProduct.productMaterial = this.product.materialList.map(s => s.id).join(',');
newProduct.productIntro = this.product.productIntro;
newProduct.productIntro = xss(this.product.productIntro);
return newProduct;
},
... ...
... ... @@ -24,8 +24,8 @@
<em class="upload-img-tip">尺寸要求150px*150px&nbsp;&nbsp;不大于500KB</em>
</Form-item>
<Form-item label="店铺简介:">
<editor-safe :content="shopData.shopIntro" @change="updateData" :z-index="2">
</editor-safe>
<editor :content="shopData.shopIntro" @change="updateData" :z-index="2">
</editor>
</Form-item>
<Form-item label="品牌-供应商:">
<Table :columns="tableCols" width="700" :data="tableData"></Table>
... ... @@ -38,7 +38,7 @@
</template>
<script>
import xss from 'xss';
import ShopService from 'services/shop/shop-service';
const SHOPNATURE = {
... ... @@ -100,7 +100,7 @@
shopRelationList: this.shopData.shopRelationList,
shopsId: this.shopData.shopsId,
shopsType: this.shopData.shopsType,
shopIntro: this.shopData.shopIntro
shopIntro: xss(this.shopData.shopIntro)
};
return result;
... ...
import axios from 'axios';
import settle from 'axios/lib/core/settle';
import cache from 'cache';
import cache from 'util/cache';
import crypto from 'util/crypto';
export default {
... ...
... ... @@ -22,8 +22,8 @@
</div>
</Form-item>
<Form-item label="简介:" prop="intro">
<editor-safe :content="modelData.intro" @change="editorChange" :z-index="2">
</editor-safe>
<editor :content="modelData.intro" @change="editorChange" :z-index="2">
</editor>
</Form-item>
<Form-item>
<Button type="primary" @click="submit">保存</Button>
... ...
... ... @@ -46,10 +46,6 @@ module.exports = {
},
modules: [
resolve(''),
resolve('scss'),
resolve('config'),
resolve('services'),
resolve('util'),
'node_modules'
]
},
... ...
... ... @@ -71,6 +71,7 @@
"vue-router": "^2.7.0",
"vue-template-compiler": "^2.4.2",
"xlsx2json": "^1.0.0",
"xss": "^0.3.3",
"yoho-cookie": "^1.2.0",
"yoho-node-lib": "^0.2.18",
"yoho-store": "^1.3.20"
... ...
... ... @@ -1767,6 +1767,10 @@ cssesc@^0.1.0:
version "0.1.0"
resolved "http://npm.yoho.cn/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4"
cssfilter@0.0.9:
version "0.0.9"
resolved "http://npm.yoho.cn/cssfilter/-/cssfilter-0.0.9.tgz#8f5ceb3aabd768db539da4582b2152d63ef7715e"
"cssnano@>=2.6.1 <4", cssnano@^3.4.0:
version "3.10.0"
resolved "http://npm.yoho.cn/cssnano/-/cssnano-3.10.0.tgz#4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38"
... ... @@ -6972,6 +6976,13 @@ xss-filters@^1.2.6:
version "1.2.7"
resolved "http://npm.yoho.cn/xss-filters/-/xss-filters-1.2.7.tgz#59fa1de201f36f2f3470dcac5f58ccc2830b0a9a"
xss@^0.3.3:
version "0.3.3"
resolved "http://npm.yoho.cn/xss/-/xss-0.3.3.tgz#a014360dee10317331f9e74258141f7ed03fc784"
dependencies:
commander "^2.9.0"
cssfilter "0.0.9"
"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0:
version "4.0.1"
resolved "http://npm.yoho.cn/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
... ...