Parcourir la source

操盘手上线

朱鑫波 il y a 3 ans
Parent
commit
ff77fd8240

+ 13 - 0
package-lock.json

@@ -2228,6 +2228,11 @@
         "@xtuc/long": "4.2.2"
       }
     },
+    "@xmldom/xmldom": {
+      "version": "0.8.2",
+      "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.2.tgz",
+      "integrity": "sha512-+R0juSseERyoPvnBQ/cZih6bpF7IpCXlWbHRoCRzYzqpz6gWHOgf8o4MOEf6KBVuOyqU+gCNLkCWVIJAro8XyQ=="
+    },
     "@xtuc/ieee754": {
       "version": "1.2.0",
       "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
@@ -4298,6 +4303,14 @@
       "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",
       "dev": true
     },
+    "cos-js-sdk-v5": {
+      "version": "1.3.8",
+      "resolved": "https://registry.npmjs.org/cos-js-sdk-v5/-/cos-js-sdk-v5-1.3.8.tgz",
+      "integrity": "sha512-jZCdjK7W5PbNLyafLEfTLmx1v4PO9zHHn0xloRMETxmBpvg57P8RoiC4maShyF3ieduVBClkuevtrbRbECdXFQ==",
+      "requires": {
+        "@xmldom/xmldom": "^0.8.2"
+      }
+    },
     "cosmiconfig": {
       "version": "5.2.1",
       "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz",

+ 1 - 0
package.json

@@ -40,6 +40,7 @@
     "axios": "0.24.0",
     "clipboard": "2.0.8",
     "core-js": "3.19.1",
+    "cos-js-sdk-v5": "^1.3.8",
     "echarts": "4.9.0",
     "element-ui": "2.15.8",
     "file-saver": "2.0.5",

+ 1 - 0
public/index.html

@@ -204,5 +204,6 @@
 		    <div class="load_title">正在加载系统资源,请耐心等待</div>
         </div>
 	</div>
+  <script src="https://cdn.jsdelivr.net/npm/cos-js-sdk-v5/dist/cos-js-sdk-v5.min.js"></script>
   </body>
 </html>

+ 122 - 0
src/api/trader/trader.js

@@ -0,0 +1,122 @@
+import request from '@/utils/request'
+
+// 获取直播账户列表
+export function getList(query) {
+	return request({
+		url: '/live/account/list',
+		method: 'get',
+		params: query
+	})
+}
+
+// 获取销售/运营列表
+export function getQueryRolesList(query) {
+	return request({
+		url: '/live/account/queryRoles',
+		method: 'get',
+		params: query
+	})
+}
+
+// 查询快手昵称列表 
+export function getQueryNicknameList(query) {
+	return request({
+		url: '/live/account/queryNicknameList',
+		method: 'get',
+		params: query
+	})
+}
+
+// 查询快手账户列表 
+export function getQueryAccountList(query) {
+	return request({
+		url: '/live/account/queryAccountListByKsId',
+		method: 'get',
+		params: query
+	})
+}
+
+// 新增快手直播账户
+export function addAccount(query) {
+	return request({
+		url: '/live/account/add',
+		method: 'post',
+		data: query
+	})
+}
+
+// 编辑快手直播账户
+export function editAccount(query) {
+	return request({
+		url: '/live/account/edit',
+		method: 'post',
+		data: query
+	})
+}
+
+// 获取快手直播账户详情
+export function getById(query) {
+	return request({
+		url: '/live/account/getById',
+		method: 'get',
+		params: query
+	})
+}
+
+// 新增直播
+export function addBroadcast(query) {
+	return request({
+		url: '/live/broadcast/add',
+		method: 'post',
+		data: query
+	})
+}
+
+// 修改直播
+export function editBroadcast(query) {
+	return request({
+		url: '/live/broadcast/edit',
+		method: 'post',
+		data: query
+	})
+}
+
+// 上传数据
+export function dataUpload(query) {
+	return request({
+		url: '/live/broadcast/dataUpload',
+		method: 'post',
+		data: query
+	})
+}
+
+
+// 上传复盘数据
+export function replay(query) {
+	return request({
+		url: '/live/broadcast/replay',
+		method: 'post',
+		data: query
+	})
+}
+
+// 获取直播列表
+export function getBroadcastList(query) {
+	return request({
+		url: '/live/broadcast/list',
+		method: 'get',
+		params: query
+	})
+}
+
+
+// 获取直播数据回显
+export function getForEdit(query) {
+	return request({
+		url: '/live/broadcast/getForEdit',
+		method: 'get',
+		params: query
+	})
+}
+
+

+ 4 - 1
src/utils/request.js

@@ -15,7 +15,10 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 // 创建axios实例
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
-  baseURL: 'http://192.168.0.195:9003',
+  // http://ruixuan.api.tjyourong.com.cn 线上
+  // http://192.168.0.195:9003 测试
+  // http://192.168.1.59:9003 西安
+  baseURL: 'http://ruixuan.api.tjyourong.com.cn',
   // 超时
   timeout: 300000
 })

Fichier diff supprimé car celui-ci est trop grand
+ 1190 - 0
src/views/trader/accountList.vue


+ 168 - 0
src/views/trader/components/upload.vue

@@ -0,0 +1,168 @@
+<template>
+  <div class="upload-file">
+    <el-upload
+      :action="action"
+      :before-upload="handleBeforeUpload"
+      :file-list="fileList"
+      :drag="drag"
+      :limit="4"
+      multiple
+      :on-remove="handleDelete"
+      :accept="accept"
+      :on-error="handleUploadError"
+      :on-exceed="handleExceed"
+      :on-success="handleUploadSuccess"
+      :on-change="handChange"
+      :show-file-list="true"
+      :auto-upload="false"
+      class="upload-file-uploader"
+      ref="upload"
+    >
+      <i class="el-icon-upload"></i>
+      <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+      <div class="el-upload__tip">只能上传xls,xlsx,csv文件</div>
+    </el-upload>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "upload-file",
+  components: {},
+  props: {
+    // 值
+    value: [String, Object, Array],
+    // 大小限制(MB)
+    fileSize: {
+      type: Number,
+      default: 2,
+    },
+    // 文件类型, 例如['png', 'jpg', 'jpeg']
+    fileType: {
+      type: Array,
+      default: () => [
+        // ".jpg",
+        // ".jpeg",
+        // ".png",
+        // ".doc",
+        ".xls",
+        ".xlsx",
+        // ".ppt",
+        // ".txt",
+        // ".pdf",
+        ".csv",
+      ],
+    },
+    // 是否显示提示
+    isShowTip: {
+      type: Boolean,
+      default: true,
+    },
+  },
+  data() {
+    return {
+      drag: true,
+      // 已选择文件列表
+      fileList: [],
+      // 是否显示文件上传弹窗
+      visible: false,
+      // 可上传的文件类型
+      accept: "",
+      action: "action",
+    };
+  },
+  filters: {},
+  computed: {},
+  mounted() {},
+  watch: {},
+  created() {
+    // 拼接
+    this.fileType.forEach((el) => {
+      this.accept += el;
+      this.accept += ",";
+    });
+    this.fileType.slice(0, this.fileList.length - 2);
+  },
+  methods: {
+    // 上传前校检格式和大小
+    handleBeforeUpload(file) {
+      // 校检文件类型
+      if (this.fileType) {
+        let fileExtension = "";
+        if (file.name.lastIndexOf(".") > -1) {
+          fileExtension = file.name.slice(file.name.lastIndexOf("."));
+        }
+        const isTypeOk = this.fileType.some((type) => {
+          if (file.type.indexOf(type) > -1) return true;
+          if (fileExtension && fileExtension.indexOf(type) > -1) return true;
+          return false;
+        });
+        if (!isTypeOk) {
+          this.$message.error(
+            `文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
+          );
+          return false;
+        }
+      }
+      // 校检文件大小
+      if (this.fileSize) {
+        const isLt = file.size / 1024 / 1024 < this.fileSize;
+        if (!isLt) {
+          this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
+          return false;
+        }
+      }
+      return true;
+    },
+    // 文件个数超出
+    handleExceed() {
+      this.$message.error(`只允许上传4个文件`);
+    },
+    // 上传失败
+    handleUploadError(err) {
+      this.$message.error("上传失败, 请重试");
+    },
+    // 上传成功回调
+    handleUploadSuccess(res, file) {
+      this.$message.success("上传成功");
+      this.cancel();
+    },
+    /** 文件状态改变时调用 */
+    handChange(file, fileList) {
+      this.fileList = fileList;
+    },
+    // 删除文件
+    handleDelete(file, list) {
+      var index = this.fileList.findIndex((v) => v.uid === file.uid);
+      if(index>-1){
+        this.fileList.splice(index, 1);
+      }
+    },
+    // 获取文件名称
+    getFileName(name) {
+      if (name.lastIndexOf("/") > -1) {
+        return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
+      } else {
+        return "";
+      }
+    },
+    /** 手动提交上传 */
+    submitUpload() {
+      if (this.fileList.length <= 0) {
+        this.msgError("请选择文件上传");
+        return false;
+      }
+      const formData = new FormData();
+      // 把多个文件放到同一个请求里,这样只会请求一次接口。否则一个文件就会请求一次
+      this.fileList.forEach((el) => {
+        formData.append("file", el.raw);
+      });
+    },
+    /** 关闭上传弹框 */
+    cancel() {
+      this.fileList = [];
+      this.visible = false;
+    },
+  },
+};
+</script>

+ 317 - 0
src/views/trader/components/vueUpload.vue

@@ -0,0 +1,317 @@
+<template>
+  <div class="upload-file">
+    <div v-if="uploadType == 'image'">
+      <el-upload
+        action="#"
+        :list-type="listType"
+        :auto-upload="true"
+        :accept="accept"
+        :before-upload="beforeUpload"
+        :multiple="multiple"
+        :file-list="fileList"
+        :on-remove="handleRemove"
+      >
+        <i slot="default" class="el-icon-plus"></i>
+        <div slot="file" slot-scope="{ file }">
+          <img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
+          <span class="el-upload-list__item-actions">
+            <span
+              class="el-upload-list__item-preview"
+              @click="handlePictureCardPreview(file)"
+            >
+              <i class="el-icon-zoom-in"></i>
+            </span>
+            <span
+              class="el-upload-list__item-delete"
+              @click="handleRemove(file)"
+            >
+              <i class="el-icon-delete"></i>
+            </span>
+          </span>
+        </div> 
+        <div class="el-upload__tip" slot="tip">只能上传jpg/jpeg/png文件</div>
+      </el-upload>
+    </div>
+    <div v-else-if="uploadType == 'all'">
+      <el-upload
+        action="#"
+        :list-type="listType"
+        :auto-upload="true"
+        :accept="accept"
+        :before-upload="beforeUpload"
+        :multiple="multiple"
+        :file-list="fileList"
+        :on-remove="handleRemove"
+      >
+        <el-button slot="trigger" size="small" type="primary"
+          >选取文件</el-button
+        >
+        <div class="el-upload__tip" slot="tip">
+          只能上传.doc, .xls, .xlsx, .ppt, .pdf, .csv文件
+        </div>
+      </el-upload>
+    </div>
+
+    <el-dialog :visible.sync="dialogVisible">
+      <img width="100%" :src="dialogImageUrl" alt="" />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+var COS = require("cos-js-sdk-v5");
+var cos = new COS({
+  SecretId: "AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets",
+  SecretKey: "tXzuwMfplTTK3c9GFUyETilasvQfePu9",
+});
+var i = 0;
+const oneKB = 1024;
+
+function getBase64(file) {
+  return new Promise((resolve, reject) => {
+    const reader = new FileReader();
+    reader.readAsDataURL(file);
+    reader.onload = () => resolve(reader.result);
+    reader.onerror = (error) => reject(error);
+  });
+}
+export default {
+  name: "upload-file",
+  components: {},
+  props: {
+    uploadType: {
+      //上传类型  值为  image/video,同时目录名称也是这样
+      type: String,
+      default() {
+        return "image";
+      },
+    },
+    listType: {
+      //上传类型  值为  image/video,同时目录名称也是这样
+      type: String,
+      default() {
+        return "picture-card";
+      },
+    },
+
+    multiple: {
+      // true 可以批量上传  false 不可以
+      type: Boolean,
+      default() {
+        return true;
+      },
+    },
+    fileCount: {
+      //最大上传数量
+      type: Number,
+      default() {
+        return 10;
+      },
+    },
+    checkFile: {
+      //返回promise方法,判读文件是否上传过,进行上传拦截
+      type: Function,
+      default() {
+        return Promise.resolve();
+      },
+    },
+    // 文件类型, 例如['png', 'jpg', 'jpeg']
+    fileType: {
+      type: Array,
+      default: () => [
+        ".jpg",
+        ".jpeg",
+        ".png",
+        // ".doc",
+        // ".xls",
+        // ".xlsx",
+        // ".ppt",
+        // ".txt",
+        // ".pdf",
+        // ".csv",
+      ],
+    },
+    size: {
+      type: Number,
+      default() {
+        if (this.sizeCheck) {
+          if (this.uploadType == "image") {
+            return 2048;
+          } else {
+            return 102400;
+          }
+        }
+      },
+    },
+    sizeCheck: {
+      type: Boolean,
+      default() {
+        return true;
+      },
+    },
+    onOversize: {
+      type: Function,
+      default() {
+        alert(`请选择${this.size}KB内的文件!`);
+      },
+    },
+  },
+  data() {
+    return {
+      dialogImageUrl: "",
+      dialogVisible: false,
+      disabled: false,
+      fileList: [],
+      accept: "",
+    };
+  },
+  filters: {},
+  computed: {},
+  mounted() {
+    this.fileType.forEach((el) => {
+      this.accept += el;
+      this.accept += ",";
+    });
+  },
+  methods: {
+    handleRemove(file) {
+      var index = this.fileList.findIndex((v) => v.url === file.url);
+      if(index>-1){
+        this.fileList.splice(index, 1);
+      }
+      
+    },
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+
+      this.dialogVisible = true;
+    },
+    handleDownload(file) {
+      console.log(file);
+    },
+    handleCancel() {
+      closeAllVideoFun();
+      this.previewVisible = false;
+    },
+    handleChange(info) {
+      if (info.file.status === "uploading") {
+        this.loading = true;
+        return;
+      }
+      if (info.file.status === "done") {
+        // Get this url from response in real world.
+        getBase64(info.file.originFileObj, (imageUrl) => {
+          this.imageUrl = imageUrl;
+          this.loading = false;
+        });
+      }
+    },
+    async handlePreview(file) {
+      if (!file.url && !file.preview) {
+        file.preview = await getBase64(file.originFileObj);
+      }
+      this.previewImage = file.url || file.preview;
+      this.previewVisible = true;
+    },
+    beforeUpload(file) {
+      console.log(file);
+      if (!this.multiple && this.fileList.length == 1) {
+        this.$message.error("请删除之后再上传");
+        return;
+      }
+      this.cosUpload(file);
+      return false;
+    },
+    clearAll() {
+      this.fileList = [];
+    },
+    cosUpload(file) {
+      var that = this;
+      let date = new Date();
+      let y = date.getFullYear();
+      let MM = date.getMonth() + 1;
+      MM = MM < 10 ? "0" + MM : MM;
+      let d = date.getDate();
+      d = d < 10 ? "0" + d : d;
+      var timeElse = new Date().getTime();
+      var arr = file.name.split(".");
+
+      var str = "";
+      for (let i = 0; i < arr.length; i++) {
+        if (i == arr.length - 1) {
+        } else {
+          if (i == arr.length - 2) {
+            str += arr[i];
+          } else {
+            str += arr[i] + ".";
+          }
+        }
+      }
+      // console.log(str + '-' + timeElse + '.' + arr[arr.length - 1])
+      cos.putObject(
+        {
+          Bucket: "live-1301855440",
+          /* 必须 */
+          Region: "ap-chongqing",
+          /* 存储桶所在地域,必须字段 */
+          Key:
+            "CaoPanShou" +
+            "/" +
+            y +
+            MM +
+            d +
+            "/" +
+            str +
+            "-" +
+            timeElse +
+            "." +
+            arr[arr.length - 1],
+          /* 必须 */
+          StorageClass: "STANDARD",
+          Body: file, // 上传文件对象
+          onProgress: function (progressData) {
+            //进度条方法
+
+            that.percent = progressData.percent * 100;
+          },
+          onTaskReady: function (tid) {
+            // console.log('onTaskReady', tid);
+          },
+          onTaskStart: function (info) {
+            //开始上传
+            // console.log('onTaskStart', info);
+          },
+        },
+        function (err, data) {
+          if (err) {
+            that.loadingElse = false;
+            that.$message.error("上传失败!!!" + err);
+            return;
+          }
+          // alert('成功')
+          that.loadingElse = false;
+          if (that.multiple) {
+            that.fileList.push({
+              uid: file.name,
+              name: file.name,
+              status: "done",
+              url: "//" + data.Location,
+            });
+          } else {
+            that.fileList = [
+              {
+                uid: file.name,
+                name: file.name,
+                status: "done",
+                url: "//" + data.Location,
+              },
+            ];
+          }
+
+          console.log(that.fileList);
+        }
+      );
+    },
+  },
+};
+</script>

Fichier diff supprimé car celui-ci est trop grand
+ 890 - 362
src/views/trader/index.vue