| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362 | <template>  <div class="share">    <div class="preview">      <div class="phone-top"></div>      <div class="phone-center"></div>      <div class="content">        <div class="phone-status"></div>        <div class="preview-area"></div>      </div>      <div class="phone-bottom"></div>    </div>    <div class="setting">      <img class="share-close" src="../assets/images/share-close.png" alt="" @click="closeBtn">      <div class="share-title">分享设置</div>      <div class="share-titleBox">        <div class="top">          <el-input type="text" placeholder="h5测试分享标题" v-model="shareModel.shareTitle" maxlength="30" show-word-limit>          </el-input>        </div>        <div class="content">          <el-input class="input" type="textarea" :rows="3" placeholder="请输入内容" v-model="shareModel.shareContent"            maxlength="30" show-word-limit>          </el-input>          <el-upload class="upload-demo" action="no_useing" accept="image/*" ref="my-upload" :http-request="uploadFile"            :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :show-file-list="false">            <div class="changeCover">              <img class="cover" :src="shareImg" alt="">              <div class="cover-title">更换封面</div>            </div>          </el-upload>        </div>      </div>      <div class="qrcode-title">渠道二维码        <div class="qrcode-copy" @click="copy">          <img class="qrcode-copy-img" src="../assets/images/qrcode-copy.png" alt="">          复制链接        </div>      </div>      <!-- <div class="qrcode">        <el-input v-model="input" placeholder="请输入内容"></el-input>        <img class="qrcode-img" src="" alt="">        <div class="qrcode-btn">          <div class="qrcode-download" @click="save">下载二维码</div>          <div class="qrcode-copy" @click="save">            <img class="qrcode-copy-img" src="../assets/images/qrcode-copy.png" alt="">            复制链接</div>        </div>      </div>      <div class="qrcode-add">添加渠道</div> -->      <div class="share-save" @click="save">确定</div>    </div>  </div></template><script>import editorApi from "../api/editor";import * as http from "../util/http";export default {  data() {    return {      shareImg: ""    };  },  props: {    close: {      type: Function,      default: null    },    shareModel: ""  },  watch: {    shareModel(val) {      console.log("shareModel", this.shareModel);      this.shareImg = val.shareImg;    }  },  methods: {    async uploadFile(file) {      console.log("上传", file);      var that = this;      http.uploadMaterielFile(        file.file,        function(res) {          that.shareImg = res;          console.log("上传结果1", res);        },        function(res) {          console.log("上传结果中", res);        }      );    },    handleAvatarSuccess() {      console.log("成功");    },    beforeAvatarUpload() {      console.log("失败");    },    copy() {      this.$message.success("复制成功");    },    closeBtn() {      this.close();    },    save() {      this.shareModel["updator"] = "admin";      this.shareModel["shareImg"] = this.shareImg;      editorApi.saveTheme(this.shareModel).then(res => {        if (res.success) {          this.$message.success("保存成功");        } else {          this.$message.error("数据加载失败,请重试");        }      });      console.log("XXXX", this.currItem);    }  }};</script><style lang="less" scoped>.share {  z-index: 1000;  position: fixed;  top: 0;  right: 0;  bottom: 0;  left: 0;  background: rgba(0, 0, 0, 0.6);  display: flex;  flex-direction: row;  .preview {    flex-grow: 2;    display: flex;    flex-direction: column;    justify-content: center;    align-items: center;    .phone-top {      width: 341px;      height: 83px;      background: url(../assets/images/phone-model-top.png) center no-repeat;      background-size: cover;    }    .phone-center {      position: relative;      width: 346px;      height: 530px;      background: url(../assets/images/phone-model-center.png) repeat-y;      background-size: cover;    }    .content {      position: absolute;      width: 298px;      height: 530px;      .phone-status {        margin-left: -2px;        margin-top: -2px;        width: 300px;        height: 50px;        background: url(../assets/images/phone-model-status.png) repeat-y;        background-size: cover;      }      .preview-area {        position: relative;        margin-left: -1px;        width: 298px;        height: 480px;        border: 1px solid #000;        border-top: 0px;      }    }    .phone-bottom {      width: 342px;      height: 87px;      background: url(../assets/images/phone-model-bottom.png) center no-repeat;      background-size: cover;    }  }  .setting {    overflow: auto;    width: 446px;    height: 100%;    background: #fff;    .share-close {      z-index: 1001;      position: absolute;      top: 0px;      right: 0px;      width: 63px;      height: 57px;      cursor: pointer;    }    .share-title {      margin: 80px 0px 10px 18px;      font-size: 16px;      font-family: PingFangSC-Regular;      font-weight: 400;      color: rgba(0, 0, 0, 1);      line-height: 22px;    }    .share-titleBox {      margin: 0px 12px;      height: 150px;      border-radius: 4px;      border: 1px solid rgba(204, 204, 204, 1);      .top {        display: flex;        flex-direction: row;        justify-content: space-between;        margin: 10px;      }      .content {        display: flex;        position: relative;        .input {          width: 326px;          margin-left: 10px;        }        .changeCover {          margin: 0px 10px;          width: 70px;          height: 70px;          background: rgba(239, 239, 239, 1);          cursor: pointer;          .cover {            width: 100%;            height: 100%;          }        }        .cover-title {          position: absolute;          bottom: 0px;          right: 10px;          width: 70px;          height: 20px;          background: rgba(0, 0, 0, 0.8);          color: #fff;          font-size: 12px;          line-height: 20px;          text-align: center;        }      }    }    .qrcode-title {      margin: 28px 0px 10px 18px;      font-size: 16px;      font-family: PingFangSC-Regular;      font-weight: 400;      color: rgba(0, 0, 0, 1);      line-height: 22px;      position: relative;      .qrcode-copy {        position: absolute;        top: -5px;        left: 100px;        font-size: 14px;        font-family: PingFangSC-Regular;        font-weight: 400;        color: rgba(78, 93, 255, 1);        line-height: 30px;        text-align: center;        width: 125px;        height: 30px;        background: rgba(230, 237, 255, 1);        border-radius: 15px;        cursor: pointer;        .qrcode-copy-img {          width: 16px;          height: 16px;          vertical-align: middle;        }      }    }    .qrcode {      margin-left: 18px;      margin-bottom: 10px;      width: 408px;      height: 283px;      border: 1px solid rgba(204, 204, 204, 1);      display: flex;      flex-direction: column;      align-items: center;      .el-input {        margin-top: 16px;        width: 265px;      }      .qrcode-img {        margin-top: 16px;        width: 140px;        height: 140px;        background: rgba(239, 239, 239, 1);      }      .qrcode-btn {        display: flex;        justify-content: space-between;        width: 250px;        height: 31px;        margin-top: 20px;        font-size: 14px;        font-family: PingFangSC-Regular;        font-weight: 400;        color: rgba(78, 93, 255, 1);        line-height: 30px;        text-align: center;        .qrcode-download {          width: 91px;          height: 30px;          background: rgba(230, 237, 255, 1);          border-radius: 15px;          cursor: pointer;        }        .qrcode-copy {          width: 125px;          height: 30px;          background: rgba(230, 237, 255, 1);          border-radius: 15px;          cursor: pointer;          .qrcode-copy-img {            width: 16px;            height: 16px;            vertical-align: middle;          }        }      }    }    .qrcode-add {      margin-left: 18px;      margin-top: 20px;      width: 408px;      height: 44px;      background: rgba(241, 241, 241, 1);      border: 1px dotted rgba(192, 192, 192, 1);      line-height: 44px;      text-align: center;      font-size: 14px;      font-weight: 400;      color: rgba(78, 93, 255, 1);      cursor: pointer;    }    .share-save {      text-align: center;      width: 105px;      height: 34px;      background: rgba(78, 93, 255, 1);      border-radius: 19px;      margin-top: 167px;      margin-bottom: 94px;      margin-left: 174px;      font-weight: 500;      color: rgba(255, 255, 255, 1);      line-height: 34px;      font-size: 14px;      cursor: pointer;    }  }}</style>
 |