|  | @@ -51,7 +51,6 @@
 | 
	
		
			
				|  |  |        title="立即赠送给好友"
 | 
	
		
			
				|  |  |        :options="options"
 | 
	
		
			
				|  |  |        @select="onSelect"
 | 
	
		
			
				|  |  | -      :aria-label="giveLink"
 | 
	
		
			
				|  |  |        class="linkCodeShare"
 | 
	
		
			
				|  |  |      />
 | 
	
		
			
				|  |  |      <van-overlay :show="showGive" @click="showGive = false">
 | 
	
	
		
			
				|  | @@ -70,12 +69,15 @@
 | 
	
		
			
				|  |  |            <van-button
 | 
	
		
			
				|  |  |              style="padding: 0 1rem;border-radius: 0.4rem;"
 | 
	
		
			
				|  |  |              color="#26A2FF"
 | 
	
		
			
				|  |  | +            class="copyCode"
 | 
	
		
			
				|  |  |              @click="getCourseCode"
 | 
	
		
			
				|  |  | -            >复制链接</van-button
 | 
	
		
			
				|  |  | -          >
 | 
	
		
			
				|  |  | +            >复制链接</van-button>
 | 
	
		
			
				|  |  | +            <!-- <button ref="copys" :disabled="giveLink == ''"  id="copyLink"  data-clipboard-action="copy" data-clipboard-target="#copy_text" @click="copy">复制</button> -->
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |      </van-overlay>
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    <input type="text" v-model="giveLink"  id="copy_text" style="opacity: 0">
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  <script>
 | 
	
	
		
			
				|  | @@ -94,7 +96,7 @@ export default {
 | 
	
		
			
				|  |  |        finished: false,
 | 
	
		
			
				|  |  |        activeTab: 0,
 | 
	
		
			
				|  |  |        title: "课程详情",
 | 
	
		
			
				|  |  | -      giveLink: "",
 | 
	
		
			
				|  |  | +      giveLink: "232123123",
 | 
	
		
			
				|  |  |        noDate: false,
 | 
	
		
			
				|  |  |        showGive: false,
 | 
	
		
			
				|  |  |        options: [
 | 
	
	
		
			
				|  | @@ -123,7 +125,8 @@ export default {
 | 
	
		
			
				|  |  |            transferInAmount: 0 //已转出
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  | -      recordList: []
 | 
	
		
			
				|  |  | +      recordList: [],
 | 
	
		
			
				|  |  | +      copyBtn:null,
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    computed: {
 | 
	
	
		
			
				|  | @@ -138,29 +141,28 @@ export default {
 | 
	
		
			
				|  |  |    created() {
 | 
	
		
			
				|  |  |      this.init();
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  mounted(){
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    this.copyBtn = new Clipboard(this.$refs.copys);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  | +    //复制
 | 
	
		
			
				|  |  | +    copy () {
 | 
	
		
			
				|  |  | +      let _this = this
 | 
	
		
			
				|  |  | +      let clipboard = _this.copyBtn
 | 
	
		
			
				|  |  | +      clipboard.on('success', function () {
 | 
	
		
			
				|  |  | +        _this.$toast.success('复制成功')
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +      clipboard.on('error', function (e) {
 | 
	
		
			
				|  |  | +        console.error('复制失败',e)
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      // 分享课程方式选择
 | 
	
		
			
				|  |  |      onSelect(option) {
 | 
	
		
			
				|  |  |        if (option.name == "复制链接") {
 | 
	
		
			
				|  |  |          this.showGive = true;
 | 
	
		
			
				|  |  |          this.showShare = false;
 | 
	
		
			
				|  |  | -        // this.$dialog
 | 
	
		
			
				|  |  | -        //   .confirm({
 | 
	
		
			
				|  |  | -        //     title: "赠送课程给好友",
 | 
	
		
			
				|  |  | -        //     message: "请提醒好友尽快点击链接领取课程份额。链接分享后,1小时内有效"
 | 
	
		
			
				|  |  | -        //   })
 | 
	
		
			
				|  |  | -        //   .then(() => {
 | 
	
		
			
				|  |  | -        //     this.showGive = true;
 | 
	
		
			
				|  |  | -        //     createCourseCode(this.courseDetail.subjectId).then(res => {
 | 
	
		
			
				|  |  | -        //       this.giveLink = `${
 | 
	
		
			
				|  |  | -        //         window.location.href.split("#")[0]
 | 
	
		
			
				|  |  | -        //       }#/courseDetail/${this.$route.params.id}?code=${res}`;
 | 
	
		
			
				|  |  | -        //       this.copyLink(this.giveLink);
 | 
	
		
			
				|  |  | -        //     });
 | 
	
		
			
				|  |  | -        //   })
 | 
	
		
			
				|  |  | -        //   .catch(err => {
 | 
	
		
			
				|  |  | -        //     this.showShare = false;
 | 
	
		
			
				|  |  | -        //   });
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 获取课程码
 | 
	
	
		
			
				|  | @@ -169,86 +171,37 @@ export default {
 | 
	
		
			
				|  |  |          this.giveLink = `${window.location.href.split("#")[0]}#/courseDetail/${
 | 
	
		
			
				|  |  |            this.$route.params.id
 | 
	
		
			
				|  |  |          }?code=${res}`;
 | 
	
		
			
				|  |  | -        this.copyLink(this.giveLink);
 | 
	
		
			
				|  |  | -      });
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    // 微信分享/未使用
 | 
	
		
			
				|  |  | -    wxShare() {
 | 
	
		
			
				|  |  | -      let that = this;
 | 
	
		
			
				|  |  | -      let url = window.location.href;
 | 
	
		
			
				|  |  | -      let newurl = url.split("#")[0];
 | 
	
		
			
				|  |  | -      axios(
 | 
	
		
			
				|  |  | -        "https://i.g107.com/564/Ajax/getJsSdk",
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -          url: newurl
 | 
	
		
			
				|  |  | -        },
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -          headers: {
 | 
	
		
			
				|  |  | -            "Content-Type": "application/x-www-form-urlencoded"
 | 
	
		
			
				|  |  | -          },
 | 
	
		
			
				|  |  | -          transformRequest: [
 | 
	
		
			
				|  |  | -            function(data) {
 | 
	
		
			
				|  |  | -              // 对 data 进行任意转换处理
 | 
	
		
			
				|  |  | -              return qs.stringify(data);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -          ]
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -      )
 | 
	
		
			
				|  |  | -        .then(function(response) {
 | 
	
		
			
				|  |  | -          console.log(response);
 | 
	
		
			
				|  |  | -          var config = response.data;
 | 
	
		
			
				|  |  | -          var adress = "ceshi";
 | 
	
		
			
				|  |  | -          wx.config({
 | 
	
		
			
				|  |  | -            debug: false,
 | 
	
		
			
				|  |  | -            appId: config.appId,
 | 
	
		
			
				|  |  | -            timestamp: config.timestamp,
 | 
	
		
			
				|  |  | -            nonceStr: config.nonceStr,
 | 
	
		
			
				|  |  | -            signature: config.signature,
 | 
	
		
			
				|  |  | -            jsApiList: ["updateAppMessageShareData"]
 | 
	
		
			
				|  |  | -          });
 | 
	
		
			
				|  |  | -          wx.ready(function() {
 | 
	
		
			
				|  |  | -            wx.updateAppMessageShareData({
 | 
	
		
			
				|  |  | -              title: `${that.courseDetail.subjectName}`, // 分享标题
 | 
	
		
			
				|  |  | -              desc: `分享简介`, // 分享描述
 | 
	
		
			
				|  |  | -              link: `${window.location.href.split("#")[0]}#/courseAdDetail/${
 | 
	
		
			
				|  |  | -                this.$route.params.id
 | 
	
		
			
				|  |  | -              }/code=${res}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
 | 
	
		
			
				|  |  | -              imgUrl: `${that.courseDetail.subjectThumb}`, // 分享图标
 | 
	
		
			
				|  |  | -              success: function() {
 | 
	
		
			
				|  |  | -                // 设置成功
 | 
	
		
			
				|  |  | -              }
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -          });
 | 
	
		
			
				|  |  | +        this.copyLink().then(()=>{
 | 
	
		
			
				|  |  | +          this.$toast.success('复制成功')
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  | -        .catch(function(error) {
 | 
	
		
			
				|  |  | -          console.log(error);
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | +        // this.showGive = true;
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 复制剪切板
 | 
	
		
			
				|  |  |      copyLink() {
 | 
	
		
			
				|  |  | -      //创建输入框
 | 
	
		
			
				|  |  | -      var input = document.createElement("input");
 | 
	
		
			
				|  |  | -      //对输入框进行赋值
 | 
	
		
			
				|  |  | -      input.value = this.giveLink;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -      //添加到body中。
 | 
	
		
			
				|  |  | -      document.body.appendChild(input);
 | 
	
		
			
				|  |  | -      input.select();
 | 
	
		
			
				|  |  | -      var copyResult = document.execCommand("copy");
 | 
	
		
			
				|  |  | -      if (copyResult) {
 | 
	
		
			
				|  |  | -        this.$toast.success("复制成功~");
 | 
	
		
			
				|  |  | -        this.showGive = false;
 | 
	
		
			
				|  |  | -        //移除
 | 
	
		
			
				|  |  | -        document.body.removeChild(input);
 | 
	
		
			
				|  |  | -      } else {
 | 
	
		
			
				|  |  | -        navigator.clipboard.writeText(str);
 | 
	
		
			
				|  |  | -        this.$toast.success("复制成功~");
 | 
	
		
			
				|  |  | -        this.showGive = false;
 | 
	
		
			
				|  |  | +      let oInput = document.createElement("input");
 | 
	
		
			
				|  |  | +      oInput.value = this.giveLink;
 | 
	
		
			
				|  |  | +      document.body.appendChild(oInput);
 | 
	
		
			
				|  |  | +      oInput.select(); // 选择对象
 | 
	
		
			
				|  |  | +      if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {//兼容ios
 | 
	
		
			
				|  |  | +        if (!document.execCommand("Copy")) {
 | 
	
		
			
				|  |  | +          oInput.setSelectionRange(0, oInput.value.length);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | +      document.execCommand("Copy"); // 执行浏览器复制命令
 | 
	
		
			
				|  |  | +      document.body.removeChild(oInput);
 | 
	
		
			
				|  |  | +      return new Promise((resolve,reject)=>{
 | 
	
		
			
				|  |  | +          if (document.execCommand("Copy")) {
 | 
	
		
			
				|  |  | +              resolve(this.giveLink);
 | 
	
		
			
				|  |  | +          }else{
 | 
	
		
			
				|  |  | +              reject(this.giveLink);
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 分享弹出
 | 
	
		
			
				|  |  |      comfirmCode() {
 | 
	
		
			
				|  |  |        this.showGive = true;
 | 
	
		
			
				|  |  | +      // this.getCourseCode()
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 触底加载
 | 
	
		
			
				|  |  |      getMoreList(done) {
 | 
	
	
		
			
				|  | @@ -419,6 +372,16 @@ img {
 | 
	
		
			
				|  |  |      .copy {
 | 
	
		
			
				|  |  |        text-align: center;
 | 
	
		
			
				|  |  |        margin-top: 0.5rem;
 | 
	
		
			
				|  |  | +      #copyLink{
 | 
	
		
			
				|  |  | +        padding: 0px 1rem;
 | 
	
		
			
				|  |  | +        border-radius: 0.4rem;
 | 
	
		
			
				|  |  | +        color: white;
 | 
	
		
			
				|  |  | +        background: rgb(38, 162, 255);
 | 
	
		
			
				|  |  | +        border-color: rgb(38, 162, 255);
 | 
	
		
			
				|  |  | +        line-height: .75rem;
 | 
	
		
			
				|  |  | +        border: 0;
 | 
	
		
			
				|  |  | +        outline: none;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        p {
 | 
	
		
			
				|  |  |          font-size: 0.22rem;
 | 
	
		
			
				|  |  |          color: #888;
 |