cz 1 год назад
Родитель
Сommit
a527839c26
2 измененных файлов с 25 добавлено и 81 удалено
  1. 3 1
      src/components/headerBar/header-bar.vue
  2. 22 80
      src/components/notice/index.vue

+ 3 - 1
src/components/headerBar/header-bar.vue

@@ -391,8 +391,10 @@ function calcAutoListChidren() {
 const intervalId = ref(null);
 const scoket = ref(null);
 const socketInit = () => {
+  let prefix =
+    window.location.protocol.indexOf("https") >= 0 ? "wss://" : "ws://";
   window.ws = new WebSocket(
-    "ws://" +
+    prefix +
       import.meta.env.VITE_APP_IP +
       import.meta.env.VITE_APP_WS_API +
       "/webStock/" +

+ 22 - 80
src/components/notice/index.vue

@@ -1,12 +1,6 @@
 <template>
   <div class="commons-notice">
-    <el-dialog
-      title="系统公告"
-      v-model="value"
-      width="460px"
-      :align-center="true"
-      :before-close="handleClose"
-    >
+    <el-dialog title="系统公告" v-model="value" width="460px" :align-center="true" :before-close="handleClose">
       <div class="title">
         <!-- {{ data.length == 0 ? '暂无数据' :  data[indexCopy].title}} -->
       </div>
@@ -16,70 +10,34 @@
       </div>
       <template #footer>
         <span class="dialog-footer">
-          <el-button
-            size="small"
-            @click="index--"
-            :disabled="data.length < 2 || index == 0"
-            >上一条</el-button
-          >
-          <el-button
-            size="small"
-            @click="index++"
-            :disabled="data.length == index + 1"
-            >下一条</el-button
-          >
-          <el-button
-            type="primary"
-            size="small"
-            :disabled="data.length == 0 || data[index].isRead"
-            @click="confirm"
-            >确认已读</el-button
-          >
+          <el-button size="small" @click="index--" :disabled="data.length < 2 || index == 0">上一条</el-button>
+          <el-button size="small" @click="index++" :disabled="data.length == index + 1">下一条</el-button>
+          <el-button type="primary" size="small" :disabled="data.length == 0 || data[index].isRead" @click="confirm">确认已读</el-button>
           <!-- <span class="more" @click="moreFn">查看更多 &gt;</span> -->
         </span>
       </template>
     </el-dialog>
-    <div
-      class="notice-table-warp"
-      :class="modelValue ? 'notice-table-warp-open' : ''"
-      @click.stop="closeNoticeTableModal"
-    >
+    <div class="notice-table-warp" :class="modelValue ? 'notice-table-warp-open' : ''" @click.stop="closeNoticeTableModal">
       <div class="notice-table" @click.stop v-loading="loading">
         <div class="tabs">
           <ul>
-            <li
-              style="padding-left: 0; border: none"
-              @click="
+            <li style="padding-left: 0; border: none" @click="
                 pushInfoReq.whetherFlow = '';
                 getPushInfoInit();
-              "
-              :class="pushInfoReq.whetherFlow === '' ? 'active' : ''"
-            >
-              全部<span v-if="pushInfoReq.whetherFlow === ''"
-                >({{ pushInfoReq.total }})</span
-              >
+              " :class="pushInfoReq.whetherFlow === '' ? 'active' : ''">
+              全部<span v-if="pushInfoReq.whetherFlow === ''">({{ pushInfoReq.total }})</span>
             </li>
-            <li
-              @click="
+            <li @click="
                 pushInfoReq.whetherFlow = 1;
                 getPushInfoInit();
-              "
-              :class="pushInfoReq.whetherFlow === 1 ? 'active' : ''"
-            >
-              流程<span v-if="pushInfoReq.whetherFlow === 1"
-                >({{ pushInfoReq.total }})</span
-              >
+              " :class="pushInfoReq.whetherFlow === 1 ? 'active' : ''">
+              流程<span v-if="pushInfoReq.whetherFlow === 1">({{ pushInfoReq.total }})</span>
             </li>
-            <li
-              @click="
+            <li @click="
                 pushInfoReq.whetherFlow = 0;
                 getPushInfoInit();
-              "
-              :class="pushInfoReq.whetherFlow === 0 ? 'active' : ''"
-            >
-              业务<span v-if="pushInfoReq.whetherFlow === 0"
-                >({{ pushInfoReq.total }})</span
-              >
+              " :class="pushInfoReq.whetherFlow === 0 ? 'active' : ''">
+              业务<span v-if="pushInfoReq.whetherFlow === 0">({{ pushInfoReq.total }})</span>
             </li>
           </ul>
           <div class="more" @click="toDealWith({ businessType: 'hisMsg' })">
@@ -89,12 +47,7 @@
         <el-table :data="noticeData" style="width: 100%" @row-click="rowClick">
           <el-table-column prop="title" label="标题内容" width="250">
             <template #default="scope">
-              <el-tooltip
-                class="box-item"
-                effect="dark"
-                :content="scope.row.title"
-                placement="top"
-              >
+              <el-tooltip class="box-item" effect="dark" :content="scope.row.title" placement="top">
                 <div class="noticeData-title">{{ scope.row.title }}</div>
               </el-tooltip>
             </template>
@@ -106,30 +59,17 @@
           </el-table-column>
           <el-table-column prop="address" label="操作">
             <template #default="scope">
-              <span style="cursor: pointer" @click.stop="readFn(scope)"
-                >确认已读</span
-              >
+              <span style="cursor: pointer" @click.stop="readFn(scope)">确认已读</span>
             </template>
           </el-table-column>
         </el-table>
         <div>
-          <el-pagination
-            style="text-align: center"
-            :page-size="5"
-            layout="prev, pager, next"
-            :current-page="pushInfoReq.pageNum"
-            :total="pushInfoReq.total"
-            @current-change="handlePageChange"
-          />
+          <el-pagination style="text-align: center" :page-size="5" layout="prev, pager, next" :current-page="pushInfoReq.pageNum"
+                         :total="pushInfoReq.total" @current-change="handlePageChange" />
         </div>
         <div class="notice-btn-box" style="margin-top: 20px">
           <!-- <el-button plain disabled>点击清空</el-button> -->
-          <el-button
-            type="primary"
-            @click="allReadFn"
-            v-if="noticeData.length != 0"
-            >全部已读</el-button
-          >
+          <el-button type="primary" @click="allReadFn" v-if="noticeData.length != 0">全部已读</el-button>
         </div>
       </div>
     </div>
@@ -223,8 +163,10 @@ const confirm = () => {
   commonRead([data.value[index.value].id], "confirm");
 };
 const socketInit = () => {
+  let prefix =
+    window.location.protocol.indexOf("https") >= 0 ? "wss://" : "ws://";
   window.ws = new WebSocket(
-    "ws://" +
+    prefix +
       import.meta.env.VITE_APP_IP +
       import.meta.env.VITE_APP_WS_API +
       "/webStock/" +