zkl hace 5 años
padre
commit
3ad524ec37

+ 1 - 1
discern/config/index.js

@@ -25,9 +25,9 @@ module.exports = {
         // target: 'http://192.168.1.11:8000',  //目标接口域名
         target: 'http://120.27.222.26:5555',  //目标接口域名
         // target: 'http://39.104.94.153:9999',  //目标接口域名,
+        // target: 'http://192.168.1.8:8000',  //目标接口域名,
         changeOrigin: true,  //是否跨域
         pathRewrite: {
-          // '^/api': ''   //重写接口
           '^/bigservers': ''   //重写接口
         }
       },

+ 1 - 1
discern/src/App.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="app">
-    <keep-alive include="show">
+    <keep-alive include="home,repository,memory,seek_data,collect,message_list">
       <router-view v-if="$route.meta.keepAlive"></router-view>
     </keep-alive>
     <router-view v-if="!$route.meta.keepAlive"></router-view>

+ 1 - 0
discern/src/components/addData/addData.vue

@@ -95,6 +95,7 @@
 
 export default {
   //import引入的组件需要注入到对象中才能使用
+  name: "addData",
   components: {},
   data() {
     //这里存放数据

+ 1 - 0
discern/src/components/addData_details/addData_details.vue

@@ -72,6 +72,7 @@
 
 export default {
   //import引入的组件需要注入到对象中才能使用
+  name: 'addData_details ',
   components: {},
   data() {
     //这里存放数据

+ 3 - 1
discern/src/components/home/home.vue

@@ -553,7 +553,8 @@ export default {
       return value;
     }
   },
-  name: "Bmaptrace",
+  // name: "Bmaptrace",
+  name: "home",
   components: {
     bottomNav,
     MescrollVue // 注册mescroll组件
@@ -785,6 +786,7 @@ export default {
       this.cropper.reset();
       this.$refs["layer"].style.display = "none";
       this.loadingShow = true;
+      console.log(_this.fileA);
       // 判断用户选择的病害还是昆虫;
       if (localStorage.getItem("insect") !== null) {
         //虫害

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 2086 - 116
discern/src/components/lianxi/lianxi.vue


+ 298 - 63
discern/src/components/lianxi/lianxiA.vue

@@ -1,76 +1,311 @@
-<!--  -->
 <template>
-  <div class>
-    <vueWaterEasy :imgsArr="imgsArr" srcKey="url">
-      <template v-slot="{item}">
-        <img :src="item.src" alt />
-      </template>
-    </vueWaterEasy>
+  <div id="merchantInformation">
+    <div class="upData">
+      <label class="btn btn-orange" for="uploads">上传LOGO</label>
+      <input
+        type="file"
+        id="uploads"
+        :value="imgFile"
+        style="position:absolute; clip:rect(0 0 0 0);"
+        accept="image/png, image/jpeg, image/gif, image/jpg"
+        @change="uploadImgg($event, 1)"
+      />
+      <div class="line">
+        <div class="cropper-content">
+          <div class="cropper">
+            <vueCropper
+              ref="cropper"
+              :img="option.img"
+              :outputSize="option.size"
+              :outputType="option.outputType"
+              :info="true"
+              :full="option.full"
+              :canMove="option.canMove"
+              :canMoveBox="option.canMoveBox"
+              :original="option.original"
+              :autoCrop="option.autoCrop"
+              :autoCropWidth="option.autoCropWidth"
+              :autoCropHeight="option.autoCropHeight"
+              :fixedBox="option.fixedBox"
+              @realTime="realTime"
+              @imgLoad="imgLoad"
+            ></vueCropper>
+          </div>
+           <button @click="AddImg">确定</button>
+          <div style="margin-left:20px;">
+            <div
+              class="show-preview"
+              :style="{'width': '150px', 'height':'155px',  'overflow': 'hidden', 'margin': '5px'}"
+            >
+              <div :style="previews.div" class="preview">
+                <img :src="previews.url" :style="previews.img" />
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
   </div>
 </template>
 
 <script>
-//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
-//例如:import 《组件名称》 from '《组件路径》';
-import vueWaterEasy from './lianxi.vue'
+import { VueCropper } from "vue-cropper";
 export default {
-  //import引入的组件需要注入到对象中才能使用
-  components: {
-    vueWaterEasy
-  },
   data() {
-    //这里存放数据
     return {
-      imgsArr: [
-        {
-          src: './static/timg3.jpg'
-        },
-        {
-          src: './static/timg4.jpg'
-        },
-        {
-          src: './static/4.png'
-        },
-        {
-          src: './static/temporary/1.png'
-        },
-        {
-          src: './static/temporary/2.png'
-        },
-        {
-          src: './static/temporary/3.png'
-        },
-        {
-          src: './static/temporary/4.png'
-        },
-        {
-          src: './static/temporary/5.png'
-        },
-        {
-          src: './static/temporary/6.png'
-        },
-      ]
+      crap: false,
+      previews: {},
+      option: {
+        img: "",
+        outputSize: 1, //剪切后的图片质量(0.1-1)
+        full: false, //输出原图比例截图 props名full
+        outputType: "png",
+        canMove: true,
+        original: false,
+        canMoveBox: true,
+        autoCrop: true,
+        autoCropWidth: 132,
+        autoCropHeight: 132,
+        fixedBox: true,
+        fixedNumber: [1, 1]
+      },
+      fileName: "", //本机文件地址
+      imgFile: "",
+      imgurl: ""
     };
   },
-  //监听属性 类似于data概念
-  computed: {},
-  //监控data中的数据变化
-  watch: {},
-  //方法集合
-  methods: {},
-  //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
-  //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  beforeCreate() {}, //生命周期 - 创建之前
-  beforeMount() {}, //生命周期 - 挂载之前
-  beforeUpdate() {}, //生命周期 - 更新之前
-  updated() {}, //生命周期 - 更新之后
-  beforeDestroy() {}, //生命周期 - 销毁之前
-  destroyed() {}, //生命周期 - 销毁完成
-  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
+  components: {
+    VueCropper
+  },
+  methods: {
+    AddImg() {
+      this.$refs.cropper.getCropBlob(data => {
+        //把裁剪后的数据上传给后台
+        console.log(data);
+      });
+    },
+    // 实时预览函数
+    realTime(data) {
+      this.previews = data;
+      // console.log(this.previews);
+    },
+    //选择本地图片
+    uploadImgg(e, num) {
+      console.log("uploadImg");
+      var _this = this;
+      //上传图片
+      var file = e.target.files[0];
+      console.log(file)
+      _this.fileName = file.name;
+      if (!/\.(gif|jpg|jpeg|png|bmp|GIF|JPG|PNG)$/.test(e.target.value)) {
+        this.$message({
+          message: "图片类型必须是.gif,jpeg,jpg,png,bmp中的一种",
+          type: "warning"
+        });
+        return false;
+      }
+      var reader = new FileReader();
+      reader.onload = e => {
+        let data;
+        if (typeof e.target.result === "object") {
+          // 把Array Buffer转化为blob 如果是base64不需要
+          data = window.URL.createObjectURL(new Blob([e.target.result]));
+          console.log(data)
+        } else {
+          data = e.target.result;
+        }
+        if (num === 1) {
+          _this.option.img = data;
+        } else if (num === 2) {
+          _this.example2.img = data;
+        }
+      };
+      // 转化为base64
+      // reader.readAsDataURL(file)
+      // 转化为blob
+      reader.readAsArrayBuffer(file);
+    },
+    imgLoad(msg) {
+      console.log("imgLoad");
+      console.log(msg);
+    }
+  }
 };
 </script>
-<style lang='scss' scoped>
-//@import url(); 引入公共css类
+
+<style lang="less">
+.input_text .el-cascader .el-input .el-input__inner {
+  width: 477px;
+  height: 40px;
+  border: 1px solid #f1f1f1;
+}
+.input_text .el-select .el-input .el-input__inner {
+  width: 477px;
+  height: 40px;
+  border: 1px solid #f1f1f1;
+}
+#merchantInformation .upload-demo {
+  display: flex;
+}
+#merchantInformation .upload-demo li {
+  width: 100px;
+  height: 113px;
+  margin-top: 0px;
+  display: inline-block;
+}
+#merchantInformation .el-date-editor.el-input,
+.el-date-editor .el-input__inner {
+  width: 477px;
+  height: 40px;
+}
+#merchantInformation .upload-demo .el-upload-list {
+  display: none;
+}
+</style>
+
+<style lang="less" scoped>
+#merchantInformation {
+  height: 925px;
+  width: 890px;
+  box-shadow: 0px 0px 1px #dfdddd;
+  background: #fff;
+  overflow: hidden;
+}
+.uploadingLogo {
+  margin-right: 80px;
+}
+// .uploadingLogoa{margin-right: 70px;}
+.logoUrl {
+  max-width: 300px;
+  border-radius: 10px;
+}
+.propagandaUrl {
+  width: 265px;
+  height: 177px;
+}
+.amendd {
+  position: absolute;
+  right: 90px;
+  top: 12px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  color: #1c8cfa;
+}
+.uploadImga {
+  width: 100px;
+  height: 90px;
+  margin-top: 10px;
+}
+
+.perfect {
+  color: #1c8cfa;
+  font-size: 14px;
+  display: flex;
+  justify-content: center;
+  flex-wrap: wrap;
+  p {
+    cursor: pointer;
+    width: 100%;
+    text-align: center;
+    margin-top: 10px;
+  }
+}
+.logo_I {
+  width: 100px;
+  height: 100px;
+}
+.UploadPictures_IMG {
+  width: 120px;
+  height: 100px;
+  margin-left: 20px;
+}
+.hintsize {
+  font-size: 12px;
+  color: #343435;
+}
+.info {
+  width: 720px;
+  margin: 0 auto;
+  .oper-dv {
+    height: 20px;
+    text-align: right;
+    margin-right: 100px;
+    a {
+      font-weight: 500;
+      &:last-child {
+        margin-left: 30px;
+      }
+    }
+  }
+  .info-item {
+    margin-top: 15px;
+    label {
+      display: inline-block;
+      width: 100px;
+      text-align: right;
+    }
+    .sel-img-dv {
+      position: relative;
+      .sel-file {
+        position: absolute;
+        width: 90px;
+        height: 30px;
+        opacity: 0;
+        cursor: pointer;
+        z-index: 2;
+      }
+      .sel-btn {
+        position: absolute;
+        cursor: pointer;
+        z-index: 1;
+      }
+    }
+  }
+}
+
+.cropper-content {
+  display: flex;
+  .cropper {
+    width: 200px;
+    height: 200px;
+  }
+  .show-preview {
+    width: 132px !important;
+    height: 135px !important;
+    flex: 1;
+    -webkit-flex: 1;
+    display: flex;
+
+    .preview {
+      overflow: hidden;
+      border-radius: 20px;
+      border: 1px solid #cccccc;
+      background: #cccccc;
+      margin-left: 40px;
+    }
+  }
+}
+.cropper-content .show-preview .preview {
+  margin-left: 0;
+}
+.btn-orange {
+  width: 100px;
+  height: 40px;
+  display: block;
+  line-height: 40px;
+  background: #1c8cfa;
+  color: #fff;
+  text-align: center;
+  border-radius: 10px;
+  margin-right: 30px;
+}
+.upData {
+  display: flex;
+  align-items: center;
+  margin-top: 20px;
+}
+.line {
+  margin-left: 21px;
+}
 </style>

+ 269 - 46
discern/src/components/lianxi/lianxiB.vue

@@ -1,65 +1,288 @@
+<!--  -->
 <template>
-  <div class="index">
-    <my-scroll :page="page" :on-refresh="onRefresh" :on-pull="onPull">
-      <div slot="scrollList">
-        <ul>
-          <li v-for="(x,index) in list" :key="index">列表</li>
-        </ul>
+  <div class="cropper-component">
+    <div class="info-item">
+      <div class="btn-box">
+        <label class="btn" for="uploads">选择图片</label>
+        <input
+          type="file"
+          id="uploads"
+          :value="imgFile"
+          style="position:absolute; clip:rect(0 0 0 0);width: 1px;"
+          accept="image/png, image/jpeg, image/gif, image/jpg"
+          @change="uploadImg($event, 1)"
+        />
+
+        <!-- <input type="button" class="operation-btn" value="+" title="放大" @click="changeScale(1)" /> -->
+        <!-- <input type="button" class="operation-btn" value="-" title="缩小" @click="changeScale(-1)" /> -->
+        <!-- <input type="button" class="operation-btn" value="↺" title="左旋转" @click="rotateLeft" /> -->
+        <!-- <input type="button" class="operation-btn" value="↻" title="右旋转" @click="rotateRight" /> -->
+        <input type="button" class="operation-btn" value="↓" title="下载" @click="down('blob')" />
+        <div class="btn" @click="finish('blob')">上传头像</div>
       </div>
-    </my-scroll>
+      <div class="operation-box">
+        <div class="cropper">
+          <vueCropper
+            ref="cropper"
+            :img="option.img"
+            :outputSize="option.size"
+            :outputType="option.outputType"
+            :info="option.info"
+            :full="option.full"
+            :canMove="option.canMove"
+            :canMoveBox="option.canMoveBox"
+            :original="option.original"
+            :autoCrop="option.autoCrop"
+            :autoCropWidth="option.autoCropWidth"
+            :autoCropHeight="option.autoCropHeight"
+            :fixedBox="option.fixedBox"
+            @realTime="realTime"
+            @imgLoad="imgLoad"
+          ></vueCropper>
+        </div>
+      </div>
+      <div class="preview-box">
+        <div>预览:</div>
+        <div :style="previews.div" class="preview">
+          <img :src="previews.url" :style="previews.img" />
+        </div>
+      </div>
+    </div>
   </div>
 </template>
-<script type="text/javascript">
-import myScroll from "../upload/upload.vue";
+
+<script>
+//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+//例如:import 《组件名称》 from '《组件路径》';
+
 export default {
+  name: "cropper",
   data() {
     return {
-      list: [],
-      page: {
-        counter: 1,
-        pageStart: 1,
-        pageEnd: 1,
-        total: 10
-      }
+      //剪切图片上传
+      crap: false,
+      previews: {},
+      option: {
+        img: "", // 裁剪图片的地址
+        info: true, // 裁剪框的大小信息
+        outputSize: 1, // 剪切后的图片质量(0.1-1)
+        full: true, // 输出原图比例截图 props名full
+        outputType: "png", // 裁剪生成额图片的格式
+        canMove: true, // 能否拖动图片
+        original: false, // 上传图片是否显示原始宽高
+        canMoveBox: true, // 能否拖动截图框
+        autoCrop: true, // 是否默认生成截图框
+        autoCropWidth: 150,
+        autoCropHeight: 150,
+        fixedBox: false // 截图框固定大小
+      },
+      fileName: "", // 本机文件地址
+      downImg: "#",
+      imgFile: "",
+      uploadImgRelaPath: "" // 上传后的图片的地址(不带服务器域名)
     };
   },
+  props: ["uploadType"],
   methods: {
-    onRefresh(mun) {
-      //刷新回调
-      setTimeout(() => {
-        this.$root.$emit("setState", 3);
-      }, 500);
+    // 上传图片(点击上传按钮)
+    finish(type) {
+      console.log("finish", type);
+      let _this = this;
+      let formData = new FormData();
+      // 输出
+      if (type === "blob") {
+        this.$refs.cropper.getCropBlob(data => {
+          let img = window.URL.createObjectURL(data);
+          formData.append("multfile", data, _this.fileName);
+          formData.append("operaType", this.uploadType);
+          this.$store
+            .dispatch("UPLOAD_HEAD", formData)
+            .then(res => {
+              let data = res.data.data;
+              this.$emit("upload", data);
+              this.$message.success("上传成功!");
+            })
+            .catch(err => {
+              if (err.data) {
+                this.$message.error(err.data.msg);
+              } else {
+                this.$message.error("上传失败!");
+              }
+            });
+        });
+      } else {
+        this.$refs.cropper.getCropData(data => {
+          // this.model = true;
+          // this.modelSrc = data;
+        });
+      }
+    },
+    // 实时预览函数
+    realTime(data) {
+      console.log("realTime");
+      this.previews = data;
     },
-    onPull(mun) {
-      //加载回调
-      if (this.page.counter <= this.page.total) {
-        setTimeout(() => {
-          this.page.counter++;
-          this.$root.$emit("setState", 5);
-          for (let i = 0; i < 10; i++) {
-            this.listdata.push({});
-          }
-        }, 500);
+    // 下载图片
+    down(type) {
+      console.log(type);
+      console.log("down");
+      var aLink = document.createElement("a");
+      aLink.download = "author-img";
+      if (type === "blob") {
+        this.$refs.cropper.getCropBlob(data => {
+          this.downImg = window.URL.createObjectURL(data);
+          aLink.href = window.URL.createObjectURL(data);
+          aLink.click();
+        });
       } else {
-        this.$root.$emit("setState", 7);
+        this.$refs.cropper.getCropData(data => {
+          this.downImg = data;
+          aLink.href = data;
+          aLink.click();
+        });
       }
-    }
-  },
-  components: {
-    myScroll
-  },
-  created() {},
-  mounted() {
-    for (let i = 0; i < 1 * 50; i++) {
-      this.list.push({});
+    },
+    // 选择本地图片
+    uploadImg(e, num) {
+      console.log("uploadImg");
+      var _this = this;
+      // 上传图片
+      var file = e.target.files[0];
+      _this.fileName = file.name;
+      if (!/\.(gif|jpg|jpeg|png|bmp|GIF|JPG|PNG)$/.test(e.target.value)) {
+        alert("图片类型必须是.gif,jpeg,jpg,png,bmp中的一种");
+        return false;
+      }
+      var reader = new FileReader();
+      reader.onload = e => {
+        let data;
+        if (typeof e.target.result === "object") {
+          // 把Array Buffer转化为blob 如果是base64不需要
+          data = window.URL.createObjectURL(new Blob([e.target.result]));
+        } else {
+          data = e.target.result;
+        }
+        if (num === 1) {
+          _this.option.img = data;
+        } else if (num === 2) {
+          _this.example2.img = data;
+        }
+      };
+      // 转化为base64
+      // reader.readAsDataURL(file)
+      // 转化为blob
+      reader.readAsArrayBuffer(file);
+    },
+    imgLoad(msg) {
+      console.log("imgLoad");
+      console.log(msg);
     }
   }
 };
 </script>
-<style lang="scss" scoped>
-.index {
-}
-li {
-  color: #000;
+<style lang='scss' scoped>
+//@import url(); 引入公共css类
+.cropper-component {
+  width: 500px;
+  margin: 0 auto;
+  position: relative;
+  .btn-box {
+    margin: 20px 0;
+    position: absolute;
+    left: 0;
+    top: 0;
+    z-index: 100000;
+    .btn {
+      padding: 4px 12px;
+      text-align: center;
+      border-radius: 4px;
+      background-color: #387ef6;
+      color: #fff;
+      cursor: pointer;
+      display: inline-block;
+    }
+    .operation-btn {
+      width: 30px;
+      height: 30px;
+      line-height: 30px;
+      text-align: center;
+      background-color: #fff;
+      border: 1px solid #eaeaea;
+      cursor: pointer;
+      display: inline-block;
+      font-size: 20px;
+      color: #333;
+      padding: 0;
+      margin: 0 10px;
+    }
+  }
+  .info-item {
+    .operation-box {
+      position: fixed;
+      top: 0;
+      bottom: 0;
+      left: 0;
+      right: 0;
+      background: #fff;
+      z-index: 99999;
+      display: inline-block;
+      .cropper {
+        width: 100%;
+        height: 260px;
+      }
+    }
+    .preview-box {
+      top: 60px;
+      right: 10px;
+      .preview {
+        width: 150px;
+        height: 150px;
+        border-radius: 50%;
+        border: 1px solid #ccc;
+        background-color: #ccc;
+        margin: 5px;
+        overflow: hidden;
+      }
+    }
+  }
+
+  .v-cropper-layer {
+    position: fixed;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    background: #fff;
+    z-index: 99999;
+    display: none;
+    .layer-header {
+      position: absolute;
+      top: 0;
+      left: 0;
+      // z-index: 99999;
+      background: #fff;
+      width: 100%;
+      height: 0.8rem;
+      padding: 0 0.2rem;
+      box-sizing: border-box;
+    }
+    .cancel,
+    .confirm {
+      line-height: 0.8rem;
+      font-size: 0.28rem;
+      background: inherit;
+      border: 0;
+      outline: 0;
+      float: left;
+    }
+    .confirm {
+      float: right;
+    }
+    img {
+      position: inherit !important;
+      border-radius: inherit !important;
+      float: inherit !important;
+    }
+  }
 }
 </style>

+ 1 - 0
discern/src/components/message_list/message_list.vue

@@ -60,6 +60,7 @@
 
 <script>
 export default {
+  name: 'message_list',
   components: {},
   data() {
     //这里存放数据

+ 2 - 2
discern/src/router/index.js

@@ -74,7 +74,7 @@ export default new Router({
       },
       component: show
     },
-    {
+    { name: 'lianxi',
       path: '/lianxi',
       component: lianxi
     },
@@ -84,7 +84,7 @@ export default new Router({
       meta: {
         title: '昆虫病害档案',
         type: 'login',
-        keepAlive: false, //不需要被缓存的组件
+        keepAlive: true, //不需要被缓存的组件
       },
       component: record
     },