Browse Source

Merge branch 'master' into houxq

WINDOWS-7IFQK7E\EDY 1 year ago
parent
commit
33a4c18fa7

+ 2 - 0
package.json

@@ -19,6 +19,7 @@
     "windicss": "^3.5.6"
   },
   "dependencies": {
+    "@tinymce/tinymce-vue": "^5.1.1",
     "@vue/composition-api": "^1.4.9",
     "@vueuse/core": "^8.1.1",
     "axios": "^0.26.1",
@@ -42,6 +43,7 @@
     "qrcode": "^1.5.1",
     "require": "^2.4.20",
     "sortablejs": "^1.15.0",
+    "tinymce": "^6.6.2",
     "vue": "^2.6.14",
     "vue-pdf": "^4.3.0",
     "vue-qr": "^4.0.9",

+ 1 - 1
public/config-local.js

@@ -24,7 +24,7 @@ const production = {
 
 function isWhich() {
   if (window.location.host.includes('localhost')) {
-    return local
+    return production
   } else if (window.location.host.includes('dev')) {
     return development
   } else {

File diff suppressed because it is too large
+ 137 - 0
src/components/TinymceVue/index.vue


+ 118 - 0
src/components/TinymceVue/index_setup.vue

@@ -0,0 +1,118 @@
+<script setup>
+import { onBeforeUnmount, onMounted, ref } from 'vue';
+import tinymce from "tinymce"
+import request from '~/utils/request';
+
+const props = defineProps({
+  'id': {
+    type: String,
+    default: `tiny-${Date.now()}-${~~(Math.random() * 10000)}`
+  },
+  'htmlClass': { default: '', type: String },
+  'modelValue': { default: '' },
+  'plugins': {
+    default: function () {
+      return [
+        'advlist autolink lists link image charmap preview anchor pagebreak',
+        'searchreplace wordcount visualblocks visualchars code fullscreen',
+        'insertdatetime media nonbreaking save table directionality',
+        'template help emoticons'
+      ];
+    }, type: Array
+  },
+  toolbar1: { default: 'formatselect | bold italic  strikethrough  forecolor backcolor | link | alignleft aligncenter alignright alignjustify  | numlist bullist outdent indent  | removeformat', type: String },
+  toolbar2: { default: '', type: String },
+  other_options: {
+    default: function () {
+      return {};
+    }, type: Object
+  }
+})
+
+const emits = defineEmits(['update:modelValue'])
+
+const content = ref('')
+
+let editor = null
+let checkerTimeout = null
+let isTyping = false
+
+function init() {
+  let options = {
+    selector: '#' + props.id,
+    base_url: '/tiny',
+    language: 'zh-Hans',
+    // skin: false,
+    toolbar1: props.toolbar1,
+    toolbar2: props.toolbar2,
+    plugins: props.plugins.join(' '),
+    autosave_restore_when_empty: true,
+    init_instance_callback: (_editor) => {
+      _editor.on('KeyUp', (e) => {
+        submitNewContent();
+      });
+      _editor.on('Change', (e) => {
+        if (_editor.getContent() !== props.modelValue) {
+          submitNewContent();
+        }
+      });
+      _editor.on('init', (e) => {
+        _editor.setContent(content.value);
+        // emits('input', content.value);
+      });
+      editor = _editor;
+    },
+    images_upload_handler: (blobInfo, progress) => {
+      const file = blobInfo.blob();
+      return request({
+        $type: 'upload',
+        url: 'upload/main/file',
+        data: {
+          filedata: file
+        },
+        timeout: 1000 * 60,
+        onUploadProgress(progressEvent) {
+          progress(~~(progressEvent.loaded / progressEvent.total * 100 | 0))
+        },
+      }).then(res => {
+        if (res.code === '1') {
+          return window.GLOBAL_CONFIG.oss + (res.data.url)
+        } else {
+          return ('')
+        }
+      })
+    },
+    // to solve a third party URL
+    // paste_preprocess: (editor, args) => {
+    //   if (/^https?\:\/\/.+(png|jpg)$/.test(args.content)) {
+    //     args.content = uploadByThirdPartyUrl(args.content);
+    //   }
+    // }
+  };
+  tinymce.init(Object.assign(options, props.other_options));
+}
+
+function submitNewContent() {
+  isTyping = true;
+  if (checkerTimeout !== null) { clearTimeout(checkerTimeout); }
+  checkerTimeout = setTimeout(() => {
+    isTyping = false;
+  }, 300);
+  emits('update:modelValue', editor.getContent());
+}
+
+onMounted(() => {
+  content.value = props.modelValue
+  init()
+})
+
+onBeforeUnmount(() => {
+  editor.destroy();
+})
+</script>
+
+<template>
+  <div>
+    <textarea :id="id">{{ content }}</textarea>
+  </div>
+</template>

+ 82 - 0
src/utils/helper.ts

@@ -0,0 +1,82 @@
+export function resolveFileString(str: string) {
+  return str ? str.split(';').map(s => resolveSingleFileString(s)) : []
+}
+
+export function resolveSingleFileString(str: string, sign = '|') {
+  const [url, name] = str.split(sign)
+  return {
+    name,
+    url: url.startsWith('http') ? url : `${(window as any).GLOBAL_CONFIG.oss}/${url}`,
+    origin: url,
+  }
+}
+
+// 获取完整文件地址
+export function getFullUrl(url: string) {
+  if (!url)
+    return ''
+  return url.startsWith('http') ? url : `${(window as any).GLOBAL_CONFIG.oss}/${url}`
+}
+
+// 获取不完整文件地址
+export function getPartUrl(url: string) {
+  if (!url)
+    return ''
+  return url.startsWith('http') ? url.startsWith((window as any).GLOBAL_CONFIG.oss) ? url.substring((window as any).GLOBAL_CONFIG.oss.length) : Error('oss 地址错误') : url
+}
+
+export function getAvatarUrl(id: string) {
+  return `${(window as any).GLOBAL_CONFIG.oss}/user/main/user_avatar?user_id=${id}`
+}
+
+export function getTime(timestamp: string) {
+  if (!timestamp)
+    return ''
+
+  const date = timestamp.length === 10 ? new Date(Number(timestamp) * 1000) : new Date(timestamp)
+
+  const Year = `${date.getFullYear()}-`
+  const Month = `${date.getMonth() < 9 ? `0${date.getMonth() + 1}` : date.getMonth() + 1}-`
+
+  function format(time: number) {
+    return time < 10 ? `0${time}` : time
+  }
+
+  const D = `${format(date.getDate())} `
+  const h = `${format(date.getHours())}:` // 小时
+  const m = `${format(date.getMinutes())}:` // 分钟
+  const s = format(date.getSeconds()) // 秒
+  return Year + Month + D + h + m + s
+}
+
+export function getFileType(str: string) {
+  if (str) {
+    str = str += ''.toLocaleLowerCase()
+    const arr = str.split('.')
+    const ext = arr[arr.length - 1].toLowerCase()
+    if (['pdf'].includes(ext))
+      return 'pdf'
+    else if (['mp4'].includes(ext))
+      return 'video'
+    else if (['ppt', 'pptx', 'xls', 'xlsx', 'doc', 'docx'].includes(ext))
+      return 'office'
+    else if (['mp3'].includes(ext))
+      return 'audio'
+    else if (['png', 'jpg', 'jpeg', 'webp'].includes(ext))
+      return 'image'
+    return 'other'
+  }
+  return 'other'
+}
+
+// 手机号码带*处理
+export function dealPhone(str: string) {
+  if (str) {
+    const reg = /(\d{3})\d*(\d{4})/
+    const phone = str.replace(reg, '$1****$2')
+    return phone
+  }
+  else {
+    return ''
+  }
+}

+ 1 - 1
src/views/bjhd/hdlb/index.vue

@@ -269,7 +269,7 @@
 
 <script>
 import { hd_list, hdlb_list, hd_add, hd_edit, hd_del, sign_add } from "./api";
-import Tinymce from "@/components/Tinymce/index.vue";
+import Tinymce from "@/components/TinymceVue/index.vue";
 import FileUpload from "@/components/FileUpload/index.vue";
 import { useUserStore } from "@/stores/user";
 const { token, real_name } = useUserStore();

+ 1 - 1
src/views/bjhd/hdlbgl/index.vue

@@ -50,7 +50,7 @@
       <el-table-column label="是否启用" width="">
         <template slot-scope="scope">
           <span v-if="scope.row.xdbh_sfqy_option_k == 1">启用</span>
-          <span class="text-red" v-if="scope.row.xdbh_sfqy_option_k == 2"
+          <span class="text-red" v-else
             >禁用</span
           >
         </template>

+ 14 - 0
src/views/wypj/xsewm/api.js

@@ -105,6 +105,20 @@ export const wypj_edit = (data = {}) => {
   });
 };
 
+export const wypj_detail = (data = {}) => {
+  return request({
+    url: "/xddy/dygl_wypj_pjjl/detail",
+    data,
+  });
+};
+
+export const wypj_del = (data = {}) => {
+  return request({
+    url: "/xddy/dygl_wypj_pjjl/delete",
+    data,
+  });
+};
+
 export const jfdh_add = (data = {}) => {
   return request({
     url: "/xddy/dygl_wypj_xsjfdhqk/add",

+ 70 - 6
src/views/wypj/xsewm/index.vue

@@ -80,9 +80,11 @@
             <div v-else>-</div>
           </template>
         </el-table-column>
-        <el-table-column label="操作">
+        <el-table-column label="操作" width="160">
           <template slot-scope="scope">
             <el-button type="text" @click="editScore(scope.row)">编辑</el-button>
+            <el-button type="text" @click="delScore(scope.row)">删除</el-button>
+            <el-button type="text" @click="handlePic(scope.row)">查看照片</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -122,12 +124,21 @@
         <el-button type="primary" @click="jfdhSubmit('jfForm')">确 定</el-button>
       </div>
     </el-dialog>
+    <el-dialog title="查看照片" :visible.sync="photoVisible" width="620px">
+      <div v-if="photoList.length > 0">
+        <el-image v-for="(item, index) in photoList" :key="index" style="width: 100px; height: 100px" :src="item"
+          :preview-src-list="photoList">
+        </el-image>
+      </div>
+      <el-empty v-else description="暂无图片"></el-empty>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { xsewm_list, xsewm_export, grade_search, class_search, wypj_pf, wypj_edit, jfdh_add } from "./api";
+import { xsewm_list, xsewm_export, grade_search, class_search, wypj_pf, wypj_edit, jfdh_add, wypj_detail, wypj_del } from "./api";
 import { useUserStore } from "@/stores/user";
+import { getFullUrl } from '@/utils/helper'
 const { token } = useUserStore();
 import VueQr from "vue-qr";
 import { xqgl_list } from '../../xsxjk/xjk/api';
@@ -195,6 +206,9 @@ export default {
         ],
       },
       flag: false,
+      photo: {},
+      photoList: [],
+      photoVisible: false,
     };
   },
   methods: {
@@ -290,18 +304,20 @@ export default {
       this.firstForm.class = "";
     },
     showQr(item) {
-      this.appSrc =
+      let a =
         "http://60.188.226.44:8000/app/mobile/#/scanCode?xsxm=" +
         item.xdx_xsxm +
         "&xsxh=" +
         item.xdx_xsxh +
         "&sm_id=" +
-        item.sm_id +
+        item.dept_id +
         "&token=" +
         token +
         "&xdx_id=" +
         item.xdx_id;
-
+        // this.appSrc = a;
+       this.appSrc = encodeURI(a)
+      // this.appSrc = encodeURIComponent(a)
       this.dialogVisible = true;
     },
     // #region 评分列表弹窗
@@ -391,7 +407,7 @@ export default {
           if (this.flag) {
             return this.$message({
               message: `请填写不大于${this.stuData.xdx_jf}的积分值`,
-              type:'error'
+              type: 'error'
             })
           }
           let data = {
@@ -417,6 +433,54 @@ export default {
     },
     // #endregion
 
+    // #region 查看照片
+    handlePic(item) {
+      wypj_detail({ wdwp_id: item.wdwp_id }).then(res => {
+        if (res.code == '1') {
+          this.photo = res.data.one_info;
+          let pic = res.data.one_info.wdwp_pfyh_img;
+          this.photoList = [];
+          if (pic) {
+            let arr = pic.split(';');
+            arr.forEach(ele => {
+              this.photoList.push(getFullUrl(ele.split(',')[1]))
+              console.log(this.photoList);
+            })
+          }
+          this.photoVisible = true;
+        }
+      })
+    },
+    // #endregion
+
+    delScore(item) {
+      this.$confirm('此操作将删除该评分记录, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(() => {
+          console.log(1111111);
+          wypj_del({wdwp_id: item.wdwp_id}).then(res => {
+            if (res.code == '1') {
+              this.$message({
+                type: 'success',
+                message: '删除成功!'
+              });
+              this.getListData();
+              this.getPfList();
+            }
+          })
+        })
+        .catch(() => {
+          console.log(333333333);
+          this.$message({
+            type: 'info',
+            message: '取消操作!'
+          });
+        })
+    },
+
     switchGrade() {
       this.firstForm.class = "";
       this.classListData();