Ver código fonte

编辑通告富文本加密

zhaoxiaohai 2 anos atrás
pai
commit
9e0392adf8
1 arquivos alterados com 78 adições e 79 exclusões
  1. 78 79
      src/HManagement/notice/list/modules/edit_notice.vue

+ 78 - 79
src/HManagement/notice/list/modules/edit_notice.vue

@@ -23,10 +23,7 @@
                 <el-col :span="8">
                   <el-form-item label="板块" prop="sat_notice_classid">
                     <el-select v-model="form.sat_notice_classid" placeholder="请选择">
-                      <el-option
-                        v-for="item in options"
-                        :key="item.sat_notice_classid"
-                        :label="item.classname"
+                      <el-option v-for="item in options" :key="item.sat_notice_classid" :label="item.classname"
                         :value="item.sat_notice_classid">
                       </el-option>
                     </el-select>
@@ -34,22 +31,14 @@
                 </el-col>
                 <el-col :span="8">
                   <el-form-item label="生效日期" prop="begdate">
-                    <el-date-picker
-                      style="width:100%"
-                      v-model="form.begdate"
-                      value-format="yyyy-MM-dd"
-                      type="date"
+                    <el-date-picker style="width:100%" v-model="form.begdate" value-format="yyyy-MM-dd" type="date"
                       placeholder="生效日期">
-                    </el-date-picker>                  
+                    </el-date-picker>
                   </el-form-item>
                 </el-col>
                 <el-col :span="8">
                   <el-form-item label="截止日期" prop="enddate">
-                    <el-date-picker
-                      style="width:100%"
-                      v-model="form.enddate"
-                      value-format="yyyy-MM-dd"
-                      type="date"
+                    <el-date-picker style="width:100%" v-model="form.enddate" value-format="yyyy-MM-dd" type="date"
                       placeholder="截止日期">
                     </el-date-picker>
                   </el-form-item>
@@ -64,8 +53,11 @@
                 </el-col>
                 <el-col :span="24">
                   <el-form-item label="通告封面">
-                    <previewImage v-if="form.cover" style="width:256px" :image="image" :deletebtn="true" @onSuccess="clearCover"></previewImage>
-                    <upload v-else btntype="image" :folderid="folderid" accept=".JPG,.PNG" :bindData="{ownertable:'sat_notice',ownerid:form.sat_noticeid,usetype:'cover'}" @onSuccess="onCoverSubmit"></upload>
+                    <previewImage v-if="form.cover" style="width:256px" :image="image" :deletebtn="true"
+                      @onSuccess="clearCover"></previewImage>
+                    <upload v-else btntype="image" :folderid="folderid" accept=".JPG,.PNG"
+                      :bindData="{ ownertable: 'sat_notice', ownerid: form.sat_noticeid, usetype: 'cover' }"
+                      @onSuccess="onCoverSubmit"></upload>
                     <p class="info">注:建议上传图片大小130x80像素,大小不超过2M,格式为JPG/PNG</p>
                   </el-form-item>
                 </el-col>
@@ -75,12 +67,16 @@
           <div class="container normal-panel normal-margin">
             <attachmentList :attinfos="attinfo_video" @onSuccess="queryNoticeMain">
               <p slot="title">视频附件</p>
-              <upload slot="upload" accept=".mp4,.ogg,.webm" :folderid="folderid" :bindData="{ownertable:'sat_notice',ownerid:form.sat_noticeid,usetype:'default'}" @onSuccess="onUploadSuccess"></upload>
+              <upload slot="upload" accept=".mp4,.ogg,.webm" :folderid="folderid"
+                :bindData="{ ownertable: 'sat_notice', ownerid: form.sat_noticeid, usetype: 'default' }"
+                @onSuccess="onUploadSuccess"></upload>
             </attachmentList>
           </div>
           <div class="container normal-panel normal-margin">
             <attachmentList :attinfos="attinfo_attachment" @onSuccess="queryNoticeMain">
-              <upload slot="upload" :folderid="folderid" :bindData="{ownertable:'sat_notice',ownerid:form.sat_noticeid,usetype:'default'}" @onSuccess="onUploadSuccess"></upload>
+              <upload slot="upload" :folderid="folderid"
+                :bindData="{ ownertable: 'sat_notice', ownerid: form.sat_noticeid, usetype: 'default' }"
+                @onSuccess="onUploadSuccess"></upload>
             </attachmentList>
           </div>
           <div class="container normal-panel normal-margin">
@@ -89,7 +85,8 @@
         </el-col>
         <el-col :span="11">
           <div class="container normal-panel normal-margin">
-            <scopeOfauth :defaultData="defaultData" appidname="sat_noticeid" :dataid="$route.query.id" @onChecked="onChecked"></scopeOfauth>
+            <scopeOfauth :defaultData="defaultData" appidname="sat_noticeid" :dataid="$route.query.id"
+              @onChecked="onChecked"></scopeOfauth>
           </div>
         </el-col>
       </el-row>
@@ -103,62 +100,64 @@ import previewImage from '@/components/previewImage/index.vue'
 import attachmentList from '@/components/attachment_list/index.vue'
 import scopeOfauth from '@/components/scopeOfAuthority/index.vue'
 import myEditor from '@/components/my-editor/Editor.vue'
-
+import {
+  weBtoa
+} from "@/utils/weapp-jwt";
 export default {
-  components:{
+  components: {
     upload,
     previewImage,
     attachmentList,
     scopeOfauth,
     myEditor
   },
-  data () {
+  data() {
     return {
-      folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
-      rules:{
+      folderid: JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
+      rules: {
         title: [
           { required: true, message: '请输入课程名称', trigger: 'blur' },
         ],
         begdate: [
-          {  required: true, message: '请选择生效日期', trigger: 'change' }
+          { required: true, message: '请选择生效日期', trigger: 'change' }
         ],
         enddate: [
-          {  required: true, message: '请选择截止日期', trigger: 'change' }
+          { required: true, message: '请选择截止日期', trigger: 'change' }
         ],
         sat_notice_classid: [
-          {  required: true, message: '请选择版块', trigger: 'change' }
+          { required: true, message: '请选择版块', trigger: 'change' }
         ],
-        summary:[
+        summary: [
           { required: true, message: '请输入导语', trigger: 'blur' },
         ],
       },
-      form:{
-        "title":"",
-        "notes":"",
-        "istextrequired":1,
-        "isattrequired":1,
-        "onceonly":1,
-        "sat_submiteditmodelid":"0",
-        "begdate":"",
-        "enddate":"",
-        "issecret":false
+      form: {
+        "title": "",
+        "notes": "",
+        "istextrequired": 1,
+        "isattrequired": 1,
+        "onceonly": 1,
+        "sat_submiteditmodelid": "0",
+        "begdate": "",
+        "enddate": "",
+        "issecret": false
       },
-      defaultData:{},
-      image:{},
-      authData:{},
-      attinfo_video:[],
-      attinfo_attachment:[],
-      options:[],
+      defaultData: {},
+      image: {},
+      authData: {},
+      attinfo_video: [],
+      attinfo_attachment: [],
+      options: [],
     }
   },
-  methods:{
-    onUploadSuccess () {
-      this.form.status !== '新建'?this.queryNoticeMain():this.onSubmit()
+  methods: {
+    onUploadSuccess() {
+      this.form.status !== '新建' ? this.queryNoticeMain() : this.onSubmit()
     },
-    onSubmit () {
+    onSubmit() {
       this.$refs['form'].validate(async (valid) => {
         if (!valid) return false;
-        this.form.content = this.$refs.editor.html
+        this.form.content = weBtoa(this.$refs.editor.html);
         const res = await this.$api.requested({
           "classname": "webmanage.saletool.notice.notice",
           "method": "insertormodify_notice",
@@ -167,50 +166,50 @@ export default {
 
         this.tool.showMessage(res)
         this.insertCoursewareauth()
-        this.queryNoticeMain ()
+        this.queryNoticeMain()
       });
     },
     //通告详情
-    async queryNoticeMain () {
+    async queryNoticeMain() {
       const res = await this.$api.requested({
         "classname": "webmanage.saletool.notice.notice",
         "method": "queryNoticeMain",
-        "content": {   
-          "sat_noticeid":this.$route.query.id
+        "content": {
+          "sat_noticeid": this.$route.query.id
         }
       })
-      this.attinfo_video = res.data.attinfos.filter(e=>{
-        if (e.postfix === 'mp4' || e.postfix === 'ogg' || e.postfix === 'webm' ) {
+      this.attinfo_video = res.data.attinfos.filter(e => {
+        if (e.postfix === 'mp4' || e.postfix === 'ogg' || e.postfix === 'webm') {
           return e
         }
       })
-      this.attinfo_attachment = res.data.attinfos.filter(e=>{
-        if (e.postfix !== 'mp4' && e.postfix !== 'ogg' && e.postfix !== 'webm' ) {
+      this.attinfo_attachment = res.data.attinfos.filter(e => {
+        if (e.postfix !== 'mp4' && e.postfix !== 'ogg' && e.postfix !== 'webm') {
           return e
         }
       })
-      this.form = Object.assign({},this.form,res.data)
+      this.form = Object.assign({}, this.form, res.data)
 
       this.queryFileLink()
       this.queryNoticeClass()
     },
     // 通告板块
-    async queryNoticeClass () {
+    async queryNoticeClass() {
       const res = await this.$api.requested({
         "classname": "webmanage.saletool.notice.noticeclass",
         "method": "queryNoticeClass",
         "content": {
-            "pageNumber": 1,
-            "pageSize": 1000,
-            "where":{
-              "condition":""
-            }
+          "pageNumber": 1,
+          "pageSize": 1000,
+          "where": {
+            "condition": ""
+          }
         }
       })
       this.options = res.data
     },
     // 获取封面信息
-    async queryFileLink () {
+    async queryFileLink() {
       this.dialogEditVisible = true
       const res = await this.$api.requested({
         "classname": "system.attachment.Attachment",
@@ -218,38 +217,38 @@ export default {
         "content": {
           "ownertable": 'sat_notice',
           "ownerid": this.form.sat_noticeid,
-          "usetype":'cover'//传空返回有所
+          "usetype": 'cover'//传空返回有所
         }
       })
-      res.data[0]?this.image = res.data[0]:this.image = {url:''}
+      res.data[0] ? this.image = res.data[0] : this.image = { url: '' }
     },
-    onCoverSubmit (res) {
+    onCoverSubmit(res) {
       this.form.cover = JSON.parse(res.attinfos).data[0].url
       this.image = JSON.parse(res.attinfos).data[0]
     },
-    clearCover () {
+    clearCover() {
       this.form.cover = null
       this.image = {}
     },
     // 获取保存授权范围数据
-    onChecked (param) {
+    onChecked(param) {
       this.authData = param
     },
     // 新增授权范围
-    async insertCoursewareauth () {
+    async insertCoursewareauth() {
       const res = await this.$api.requested({
         "classname": "webmanage.saletool.notice.noticeauth",
         "method": "createNoticeAuth",
         "content": this.authData
       })
-      res.code === 0?this.$notify({
-        title:'失败',
-        message:res.data,
-        type:'error'
-      }):''
+      res.code === 0 ? this.$notify({
+        title: '失败',
+        message: res.data,
+        type: 'error'
+      }) : ''
     },
     // 查询授权信息
-    async query_auth () {
+    async query_auth() {
       const res = await this.$api.requested({
         "classname": "webmanage.saletool.notice.noticeauth",
         "method": "queryNoticeAuth",
@@ -260,7 +259,7 @@ export default {
       this.defaultData = res.data
     },
   },
-  mounted () {
+  mounted() {
     this.queryNoticeMain()
     this.query_auth()
   }