Ver Fonte

特殊字符,优化

walter há 9 meses atrás
pai
commit
477c1a90fb

+ 3 - 3
src/components/AppealRewrite.vue

@@ -3,7 +3,7 @@
     v-model="showAppealRewrite"
     position="bottom"
     duration="0.2"
-    :style="{height: '100%', width:'100%','background-colorr': 'rgb(245, 245, 245)'}"
+    :style="{height: '100%', width:'100%','background-color': 'rgb(245, 245, 245)'}"
     @open="onOpen"
     @closed="onClosed"
   >
@@ -12,14 +12,13 @@
       :left-arrow="true"
       @click-left="showAppealRewrite = false"
       @click-right="showActions = true"
-      fixed
     >
       <template slot="right" v-if="canActions">
         <van-icon name="bars"/>
       </template>
     </van-nav-bar>
 
-    <div :style="{marginTop:'1rem',height:'90%'}">
+    <div :style="{marginTop:'0.1rem',height:'90%'}">
       <van-notice-bar
         left-icon="volume-o"
         text="手机端暂不支持添加积分事件,请在电脑端操作"
@@ -211,6 +210,7 @@ export default {
 </script>
 
 <style scoped lang="less">
+.van-nav-bar--fixed{}
 .card-box{
   margin: 0.2rem auto;
   border-radius: 0.3rem;

+ 6 - 2
src/components/Mtextarea.vue

@@ -15,7 +15,7 @@
 
       <div v-else style="position: relative;min-height: 1.6rem;margin: 0.16rem;">
         <div v-html="s_text"></div>
-        <textarea :placeholder="placeholder" v-model="text" class="diy_text"></textarea>
+        <textarea :placeholder="placeholder" v-model="text" class="diy_text" @input="onTextInput"></textarea>
       </div>
       <div style="height: 0.3rem;"></div>
       <span v-show="text_max != ''" class="text-max-tip">{{ text.length }}/{{ text_max }}</span>
@@ -28,6 +28,7 @@
 
 <script>
 import Uploader from '@/components/OssUploader';
+import {specialFilter} from "../utils/helper";
 
 export default {
   name: 'Mtextarea',
@@ -115,7 +116,7 @@ export default {
     }
   },
   created() {
-    this.text = this.value;
+    this.text = specialFilter(this.value);
     this.s_imgs = this.imgs;
   },
   methods: {
@@ -131,6 +132,9 @@ export default {
       // }
       return isJPG;
     },
+    onTextInput(e){
+      this.text = specialFilter(e.target.value)
+    }
   }
 };
 </script>

+ 7 - 3
src/components/Mtextarea2.vue

@@ -15,7 +15,7 @@
       </div>
       <div v-else>
         <div v-html="s_text"></div>
-        <textarea :placeholder="placeholder" v-model="text" class="diy_text"></textarea>
+        <textarea :placeholder="placeholder" v-model="text" class="diy_text" @input="onTextInput"></textarea>
       </div>
     </div>
     <div v-show="imgs.length > 0" style="padding:0.24rem;" class="upload_box">
@@ -37,6 +37,7 @@
 
 <script>
 import Uploader from '@/components/OssUploader'
+import {specialFilter} from "../utils/helper";
 
 export default {
   name: 'Mtextarea',
@@ -124,10 +125,13 @@ export default {
     }
   },
   created () {
-    this.text = this.value
+    this.text = specialFilter(this.value)
     this.s_imgs = this.imgs
   },
   methods: {
+    onTextInput(e){
+      this.text = specialFilter(e.target.value)
+    },
     // 返回布尔值
     beforeRead(file) {
       const isJPG = /^image\/(jpeg|png|jpg)$/.test(file.type);
@@ -256,4 +260,4 @@ export default {
 .mtext-box {
   position: relative;
 }
-</style>
+</style>

+ 9 - 2
src/point/view/integral/approval_detail.vue

@@ -135,14 +135,14 @@
       <van-popup v-model="show_refuse" position="right" :style="{ height: '100%', width: '100%', 'background-color': 'rgb(245, 245, 245)' }">
         <div :style="'padding-top:' + bar_height + 'px;background-color: #238dfa;'"></div>
         <van-nav-bar title="审批拒绝" left-text="返回" @click-left="show_refuse = false" left-arrow></van-nav-bar>
-        <van-cell-group><van-field v-model="refuse_msg" rows="5" autosize type="textarea" maxlength="50" placeholder="请输入审批意见" show-word-limit /></van-cell-group>
+        <van-cell-group><van-field v-model="refuse_msg" rows="5" autosize type="textarea" maxlength="50" placeholder="请输入审批意见" show-word-limit @input="onRefuseMsgInput"/></van-cell-group>
         <div style="padding:0.32rem;"><van-button block type="info" :loading="submitting" @click="confirm_refuse">确认</van-button></div>
       </van-popup>
 
       <van-popup v-model="showRejectRewrite" position="right" :style="{height:'100%',width:'100%', backgroundColor:'rgb(245, 245, 245)'}">
         <div :style="'padding-top:' + bar_height + 'px;background-color: #238dfa;'"></div>
         <van-nav-bar title="驳回重做" left-text="返回" @click-left="showRejectRewrite = false" left-arrow></van-nav-bar>
-        <van-cell-group><van-field v-model="formRejectRewrite.remark" rows="5" autosize type="textarea" maxlength="100" placeholder="原因说明" show-word-limit /></van-cell-group>
+        <van-cell-group><van-field v-model="formRejectRewrite.remark" rows="5" autosize type="textarea" maxlength="100" placeholder="原因说明" show-word-limit @input="onRewriteRemarkInput" /></van-cell-group>
         <div style="padding:0.32rem;"><van-button block type="info" :loading="submitting" @click="rejectRewrite">确认</van-button></div>
       </van-popup>
 
@@ -186,6 +186,7 @@ import Vue from 'vue'
 import approvalProcess from '@/point/view/integral/approval_process'
 import { Dialog, Panel, Step, Steps, Overlay, ImagePreview, Collapse, CollapseItem,NoticeBar } from 'vant'
 import Footer from "../../../components/footer.vue";
+import {specialFilter} from "../../../utils/helper";
 Vue.use(Dialog)
   .use(Panel)
   .use(Step)
@@ -246,6 +247,12 @@ export default {
   },
   // 方法
   methods: {
+    onRefuseMsgInput(v){
+      this.refuse_msg = specialFilter(v)
+    },
+    onRewriteRemarkInput(v){
+      this.formRejectRewrite.remark = specialFilter(v)
+    },
     routeBack(){
       this.isHome? this.$router.replace({ name: 'home' }):this.$route_back();
     },

+ 5 - 1
src/point/view/integral/approval_list.vue

@@ -75,7 +75,7 @@
 
     <van-dialog v-model="show" title="审批拒绝" class="reject_popup" show-cancel-button :beforeClose="save_btn">
       <van-cell-group>
-        <van-field v-model="reject_text" rows="2" autosize type="textarea" maxlength="50" placeholder="请输入审批意见" show-word-limit v-validate="'required'" name="审批意见" />
+        <van-field v-model="reject_text" rows="2" autosize type="textarea" maxlength="50" placeholder="请输入审批意见" show-word-limit v-validate="'required'" name="审批意见" @input="onRejectTextInput" />
       </van-cell-group>
     </van-dialog>
   </div>
@@ -87,6 +87,7 @@ import { Tab, Tabs, Empty, DropdownMenu, DropdownItem, Search } from 'vant';
 
 import TabsList from '@/components/TabsList';
 import { _debounce } from '@/utils/auth';
+import {specialFilter} from "../../../utils/helper";
 
 Vue.use(Empty)
   .use(Tab)
@@ -293,6 +294,9 @@ export default {
       }
       return map[status] || 'info'
     },
+    onRejectTextInput(v){
+      this.reject_text = specialFilter(v)
+    }
   },
 };
 </script>

+ 5 - 1
src/point/view/integral/rule_category_add.vue

@@ -4,7 +4,7 @@
     <div class="body_com has_header">
       <scroller>
         <van-cell-group>
-          <van-field v-model="data.name" label="分类名称" name="名称" placeholder="请输入名称" v-validate="'required|max:10'" required maxlength="10" show-word-limit/>
+          <van-field v-model="data.name" label="分类名称" name="名称" placeholder="请输入名称" v-validate="'required|max:10'" required maxlength="10" show-word-limit @input="onNameInput"/>
         </van-cell-group>
         <van-cell-group>
           <CategorySelectorCell title="选择父级分类" v-model="rule_cate" :max="2" :multi="false"></CategorySelectorCell>
@@ -20,6 +20,7 @@
 
 import CategorySelectorCell from '@/components/CategorySelectorCell'
 import DeptSelectorCell from '@/components/DeptSelectorCell'
+import {specialFilter} from "../../../utils/helper";
 export default {
   name: 'rule_category_add',
   components: {
@@ -87,6 +88,9 @@ export default {
         self.send_loading = false
         self.$toast.clear()
       })
+    },
+    onNameInput(v){
+      this.data.name = specialFilter(v)
     }
   },
   created () {

+ 6 - 2
src/point/view/integral/rule_category_edit.vue

@@ -4,7 +4,7 @@
     <div class="body_com has_header">
       <scroller>
         <van-cell-group>
-          <van-field v-model="data.name" label="分类名称" name="名称" placeholder="请输入名称" v-validate="'required|max:10'" required  maxlength="10" show-word-limit/>
+          <van-field v-model="data.name" label="分类名称" name="名称" placeholder="请输入名称" v-validate="'required|max:10'" required  maxlength="10" show-word-limit @input="onNameInput"/>
         </van-cell-group>
         <van-cell-group>
           <CategorySelectorCell title="选择父级分类" v-model="rule_cate" :max="2" :multi="false"></CategorySelectorCell>
@@ -23,6 +23,7 @@
 
 import CategorySelectorCell from '@/components/CategorySelectorCell'
 import DeptSelectorCell from '@/components/DeptSelectorCell'
+import {specialFilter} from "../../../utils/helper";
 export default {
   name: 'rule_category_edit',
   components: {
@@ -116,13 +117,16 @@ export default {
         self.send_loading = false
         self.$toast.clear()
       })
+    },
+    onNameInput(v){
+      this.data.name = specialFilter(v)
     }
   },
   created () {
     if (this.$route.query.rule_id) {
       this.data.rule_id = this.$route.query.rule_id
       this.data.pid = this.$route.query.pid
-      this.data.name = this.$route.query.rule_name
+      this.data.name = specialFilter(this.$route.query.rule_name)
       let departments = JSON.parse(this.$route.query.departments)
       if (departments.length > 0) {
         this.depts = departments.map(item => {

+ 5 - 1
src/point/view/integral/rule_item_add.vue

@@ -5,7 +5,7 @@
       <scroller>
         <van-cell-group>
           <van-cell required>
-            <Mtextarea required v-model="item.remark" placeholder="输入规则内容" :text_max="300" :imgs_max="3"></Mtextarea>
+            <Mtextarea required v-model="item.remark" placeholder="输入规则内容" :text_max="300" :imgs_max="3" @input="onRemarkInput" ></Mtextarea>
           </van-cell>
         </van-cell-group>
         <van-cell-group>
@@ -65,6 +65,7 @@ import { Switch } from 'vant'
 import Mtextarea from '@/components/Mtextarea'
 import NumberInput from '@/components/NumberInput'
 import CategorySelectorCell from '@/components/CategorySelectorCell'
+import {specialFilter} from "../../../utils/helper";
 
 Vue.use(Switch)
 export default {
@@ -181,6 +182,9 @@ export default {
           self.types_list.push(list[i])
         }
       }
+    },
+    onRemarkInput(v){
+      this.item.remark = specialFilter(v)
     }
   },
   created () {

+ 6 - 1
src/point/view/integral/rule_item_edit.vue

@@ -4,7 +4,7 @@
     <div class="body_com has_header">
       <scroller>
         <van-cell-group>
-          <van-cell><Mtextarea v-model="item.remark" placeholder="输入规则内容" :text_max="300" :imgs_max="3"></Mtextarea></van-cell>
+          <van-cell><Mtextarea v-model="item.remark" placeholder="输入规则内容" :text_max="300" :imgs_max="3" @input="onRemarkInput"></Mtextarea></van-cell>
         </van-cell-group>
         <van-cell-group>
           <van-cell title="分值" class="cell-right-4rem">
@@ -41,6 +41,7 @@ import NumberInput from '@/components/NumberInput';
 import CategorySelectorCell from '@/components/CategorySelectorCell';
 import Vue from 'vue';
 import { Switch } from 'vant';
+import {specialFilter} from "../../../utils/helper";
 
 Vue.use(Switch);
 export default {
@@ -175,6 +176,9 @@ export default {
           this.types_list.push(list[i]);
         }
       }
+    },
+    onRemarkInput(v){
+      this.item.remark = specialFilter(v)
     }
   },
   created() {
@@ -189,6 +193,7 @@ export default {
         this.rule_cate = [{ id: this.item.rule_id * 1, name: this.$route.query.rule_name }];
       }
     }
+    this.item.remark = specialFilter(this.item.remark)
     this.get_point_types();
   }
 };

+ 3 - 0
src/utils/helper.js

@@ -0,0 +1,3 @@
+export function specialFilter(inputStr){
+  return inputStr.replace(/[^(\w\d\s\u4e00-\u9fa5:、,.!@$#%*{}<>+=?\-\(\)\[\])]/g,"")
+}