riku
2023-12-21 9344d08f1f68997035904181df1199fcd7c7da9f
1.完成下载环信码功能
已修改13个文件
131 ■■■■■ 文件已修改
package-lock.json 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fysp/evaluateApi.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fysp/problemApi.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fysp/sceneApi.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fysp/taskApi.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fysp/userApi.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fytz/creditApi.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fytz/noticeApi.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fytz/userApi.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components.d.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fytz/user/UserInfo.vue 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
@@ -14,6 +14,7 @@
        "axios": "^1.2.1",
        "dayjs": "^1.11.10",
        "element-plus": "^2.4.3",
        "js-base64": "^3.7.5",
        "pinia": "^2.0.26",
        "vue": "^3.2.45",
        "vue-i18n": "^9.8.0",
@@ -5043,6 +5044,11 @@
        "@sideway/formula": "^3.0.0",
        "@sideway/pinpoint": "^2.0.0"
      }
    },
    "node_modules/js-base64": {
      "version": "3.7.5",
      "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.5.tgz",
      "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
    },
    "node_modules/js-sdsl": {
      "version": "4.2.0",
@@ -10834,6 +10840,11 @@
        "@sideway/pinpoint": "^2.0.0"
      }
    },
    "js-base64": {
      "version": "3.7.5",
      "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.5.tgz",
      "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
    },
    "js-sdsl": {
      "version": "4.2.0",
      "dev": true
package.json
@@ -19,6 +19,7 @@
    "axios": "^1.2.1",
    "dayjs": "^1.11.10",
    "element-plus": "^2.4.3",
    "js-base64": "^3.7.5",
    "pinia": "^2.0.26",
    "vue": "^3.2.45",
    "vue-i18n": "^9.8.0",
src/api/fysp/evaluateApi.js
@@ -1,11 +1,10 @@
import { $fysp } from '../index';
export default {
  /**
   * 获取自动评估历史记录
   */
  fetchAutoEvaluation(param){
    return $fysp.post(`evaluation/auto/record`, param);
    return $fysp.post(`evaluation/auto/record`, param).then((res) => res.data);
  }
};
src/api/fysp/problemApi.js
@@ -10,6 +10,6 @@
   */
  checkProblem({ pId, action, remark = '', userId = id, userName = name }) {
    const params = `?pId=${pId}&action=${action}&remark=${remark}&userId=${userId}&userName=${userName}`;
    return $fysp.post(`problemlist/check${params}`);
    return $fysp.post(`problemlist/check${params}`).then((res) => res.data);
  },
};
src/api/fysp/sceneApi.js
@@ -7,7 +7,7 @@
   */
  searchScene(area, page = 1, perPage = 20) {
    const params = `page=${page}&per_page=${perPage}`;
    return $fysp.post(`scense/find?${params}`, area);
    return $fysp.post(`scense/find?${params}`, area).then((res) => res.data);
  },
  /**
@@ -16,11 +16,13 @@
   * @returns 场景详情
   */
  getSceneDetail(sId) {
    return $fysp.get(`scense/detail`, {
    return $fysp
      .get(`scense/detail`, {
      params: {
        sceneId: sId
      }
    });
      })
      .then((res) => res.data);
  },
  /**
@@ -33,21 +35,21 @@
      subScene: subScene ? JSON.stringify(subScene) : null,
      sceneDevice: sceneDevice ? sceneDevice : null
    };
    return $fysp.post(`scense/detail/update?${params}`, rb);
    return $fysp.post(`scense/detail/update?${params}`, rb).then((res) => res.data);
  },
  /**
   * 更新场景额外信息
   */
  updateSubScene(typeId, subScene) {
    return this.updateSceneDetail(typeId, { subScene: subScene });
    return this.updateSceneDetail(typeId, { subScene: subScene }).then((res) => res.data);
  },
  /**
   * 更新场景设备信息
   */
  updateSceneDevice(typeId, sceneDevice) {
    return this.updateSceneDetail(typeId, { sceneDevice: sceneDevice });
    return this.updateSceneDetail(typeId, { sceneDevice: sceneDevice }).then((res) => res.data);
  },
  /**
@@ -55,7 +57,7 @@
   * @param {Object} scene
   */
  createScene(scene) {
    return $fysp.put('scense', scene);
    return $fysp.put('scense', scene).then((res) => res.data);
  },
  /**
@@ -63,6 +65,6 @@
   * @param {Object} scene
   */
  updateScene(scene) {
    return $fysp.post('scense', scene);
    return $fysp.post('scense', scene).then((res) => res.data);
  }
};
src/api/fysp/taskApi.js
@@ -5,29 +5,33 @@
   * 获取顶层任务
   */
  getTopTask() {
    return $fysp.get('task/alltask/0');
    return $fysp.get('task/alltask/0').then((res) => res.data);
  },
  /**
   * 获取子任务统计信息
   */
  getSubtaskSummary({ topTaskId = undefined, sceneTypeId = undefined }) {
    return $fysp.get('subtask/summary', {
    return $fysp
      .get('subtask/summary', {
      params: {
        topTaskId: topTaskId,
        sceneTypeId: sceneTypeId
      }
    });
      })
      .then((res) => res.data);
  },
  /**
   * 获取子任务问题详情
   */
  getProBySubtask(id) {
    return $fysp.get('problemlist/subtask', {
    return $fysp
      .get('problemlist/subtask', {
      params: {
        stGuid: id
      }
    });
      })
      .then((res) => res.data);
  }
};
src/api/fysp/userApi.js
@@ -5,27 +5,27 @@
   * 获取用户详情
   */
  getUserById(id) {
    return $fysp.get(`userinfo/${id}`);
    return $fysp.get(`userinfo/${id}`).then((res) => res.data);
  },
  /**
   * 更新用户详情
   */
  updateUser(user) {
    return $fysp.post(`userinfo`, user);
    return $fysp.post(`userinfo`, user).then((res) => res.data);
  },
  /**
   * 获取场景的用户详情
   */
  getUserByScene(sId) {
    return $fysp.get(`userinfo/scene/get?sceneId=${sId}`);
    return $fysp.get(`userinfo/scene/get?sceneId=${sId}`).then((res) => res.data);
  },
  /**
   * 自动创建账户
   */
  autoCreateAccount(sId) {
    return $fysp.post(`userinfo/create?sceneId=${sId}`);
    return $fysp.post(`userinfo/create?sceneId=${sId}`).then((res) => res.data);
  }
};
src/api/fytz/creditApi.js
@@ -1,3 +1,4 @@
import { Base64 } from 'js-base64';
import { $fytz } from '../index';
/**
@@ -12,10 +13,11 @@
    return $fytz
      .get(`credit/ecCode/download?userId=${userId}`, { responseType: 'blob' })
      .then((res) => {
        const url = window.URL.createObjectURL(new Blob([res.data]));
        const name = Base64.decode(res.headers.get('fileName'));
        const url = window.URL.createObjectURL(res.data);
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', 'creditCode.png');
        link.setAttribute('download', name);
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
src/api/fytz/noticeApi.js
@@ -9,23 +9,27 @@
   */
  getNoticeHistory({ type, subtype = null, page = 1, perPage = 20 }) {
    const params = `userId=${id}&page=${page}&per_page=${perPage}`;
    return $fytz.post(`notifications/history?${params}`, {
    return $fytz
      .post(`notifications/history?${params}`, {
      ecNoticetype: type,
      ecNoticesubtype: subtype
    });
      })
      .then((res) => res.data);
  },
  /**
   * 获取用户未读通知
   */
  getNotification() {
    return $fytz.get('notifications', {
    return $fytz
      .get('notifications', {
      params: {
        userId: id,
        page: 1,
        per_page: 30
      }
    });
      })
      .then((res) => res.data);
  },
  /**
@@ -62,6 +66,6 @@
  releaseNotice(notice) {
    notice.authorId = id;
    notice.authorName = name;
    return $fytz.post(`notifications/${id}/release2`, notice);
    return $fytz.post(`notifications/${id}/release2`, notice).then((res) => res.data);
  }
};
src/api/fytz/userApi.js
@@ -11,7 +11,7 @@
   */
  fetchUser(page = 1, per_page = 20, data) {
    const params = `page=${page}&per_page=${per_page}`;
    return $fytz.post(`baseInfo/search/?${params}`, data);
    return $fytz.post(`baseInfo/search/?${params}`, data).then((res) => res.data);
  },
  /**
@@ -20,7 +20,7 @@
   * @returns
   */
  fetchUserBaseInfo(userId) {
    return $fytz.get(`userInfo/baseInfo?userId=${userId}`);
    return $fytz.get(`userInfo/baseInfo?userId=${userId}`).then((res) => res.data);
  },
  /**
@@ -29,7 +29,7 @@
   * @returns
   */
  updateUserInfo(data) {
    return $fytz.post('userInfo', data);
    return $fytz.post('userInfo', data).then((res) => res.data);
  },
  /**
@@ -38,13 +38,13 @@
   * @returns
   */
  createUser(data) {
    return $fytz.put('userInfo/create', data);
    return $fytz.put('userInfo/create', data).then((res) => res.data);
  },
  /**
   * 重置用户密码
   */
  resetPassword(id) {
    return $fytz.post(`userInfo/resetPw?userId=${id}`);
    return $fytz.post(`userInfo/resetPw?userId=${id}`).then((res) => res.data);
  }
};
src/api/index.js
@@ -1,7 +1,7 @@
import axios from 'axios';
import { ElMessage } from 'element-plus';
const debug = true;
const debug = false;
let ip1 = 'http://47.100.191.150:9005/';
let ip1_file = 'http://47.100.191.150:9005/';
@@ -67,7 +67,7 @@
      if (response.status == 200) {
        if (response.data.success != undefined && response.data.success != null) {
          if (response.data.success == true) {
            return response.data;
            return response;
          } else {
            ElMessage({
              message: response.data.message,
@@ -76,7 +76,7 @@
            return Promise.reject(response.data.message);
          }
        } else {
          return response.data;
          return response;
        }
      } else {
        return Promise.reject(response);
src/components.d.ts
@@ -17,6 +17,7 @@
    ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
    ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
    ElButton: typeof import('element-plus/es')['ElButton']
    ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
    ElCard: typeof import('element-plus/es')['ElCard']
    ElCascader: typeof import('element-plus/es')['ElCascader']
    ElCol: typeof import('element-plus/es')['ElCol']
@@ -59,6 +60,7 @@
    ElTabPane: typeof import('element-plus/es')['ElTabPane']
    ElTabs: typeof import('element-plus/es')['ElTabs']
    ElTag: typeof import('element-plus/es')['ElTag']
    ElText: typeof import('element-plus/es')['ElText']
    ElTooltip: typeof import('element-plus/es')['ElTooltip']
    ElTree: typeof import('element-plus/es')['ElTree']
    Footer: typeof import('./components/core/Footer.vue')['default']
src/views/fytz/user/UserInfo.vue
@@ -58,9 +58,6 @@
        </template>
        <template #default="{ row }">
          <el-space>
            <!-- <el-button :loading="row.loading1" type="primary" size="small" @click="editRow(row)"
              >查看</el-button
            > -->
            <el-button
              :loading="row.loading2"
              :type="row.userInfo.isenable != '0' ? 'danger' : 'primary'"
@@ -68,7 +65,27 @@
              @click="itemActive(row)"
              >{{ row.userInfo.isenable != '0' ? '下线' : '上线' }}</el-button
            >
            <el-dropdown
            <el-button-group>
              <el-button type="primary" :loading="row.loading1" size="small" @click="editRow(row)"
                >查看</el-button
              >
              <el-dropdown @command="handleCommand" trigger="click">
                <el-button
                  type="primary"
                  :loading="row.downloadLoading"
                  size="small"
                  :icon="row.downloadLoading ? '' : 'ArrowDown'"
                ></el-button>
                <template #dropdown>
                  <el-dropdown-menu>
                    <el-dropdown-item icon="Download" :command="{ c: 1, p: row }"
                      >下载环信码</el-dropdown-item
                    >
                  </el-dropdown-menu>
                </template>
              </el-dropdown>
            </el-button-group>
            <!-- <el-dropdown
              split-button
              :loading="row.loading1"
              size="small"
@@ -85,7 +102,7 @@
                  >
                </el-dropdown-menu>
              </template>
            </el-dropdown>
            </el-dropdown> -->
          </el-space>
        </template>
      </el-table-column>
@@ -108,12 +125,14 @@
  },
  data() {
    return {
      // 查询条件
      formSearch: {
        _locations: {},
        searchText: '',
        scensetype: {},
        online: {}
      },
      // 新增用户弹出框
      drawer: false
    };
  },
@@ -189,11 +208,14 @@
      return row.userInfo.isenable ? 'online-row' : 'offline-row';
    },
    handleCommand(e){
      const userId = e.p.userInfo.guid
      const userId = e.p.userInfo.guid;
      switch (e.c) {
        // 下载环信码
        case 1:
          creditApi.downloadCode(userId)
          e.p.downloadLoading = true;
          creditApi.downloadCode(userId).finally(() => {
            e.p.downloadLoading = false;
          });
          break;
      
        default: