guojy hace 1 año
padre
commit
297ea350be

+ 1 - 1
src/view/course/deal/dealOrder.vue

@@ -49,7 +49,7 @@
         </div>
       </div>
     </div>
-    <van-popup v-model="popupShow" position="bottom" :style="{ height: '30%' }">
+    <van-popup v-model="popupShow" position="bottom" :style="{ height: '40%' }">
       <van-picker
         title="选择课程"
         show-toolbar

+ 2 - 2
src/view/course/deal/transfer.vue

@@ -170,7 +170,7 @@ img {
   background: linear-gradient(90deg, #F3F2EE, #E7EFF9);
   position: relative;
   .transferTop {
-    padding: 0.6rem;
+    padding: 0.4rem;
     text-align: center;
     p {
       font-size: 0.6rem;
@@ -228,7 +228,7 @@ img {
     position: absolute;
     bottom: 8%;
     .transferTH {
-      margin-top: 0.7rem;
+      margin-top: 0.4rem;
       width: 100%;
       display: flex;
       justify-content: center;

+ 1 - 0
src/view/course/home.vue

@@ -329,6 +329,7 @@ export default {
           return trigger.getAttribute("aria-label");
         }
       });
+      console.log(that.clipboard)
       that.clipboard.on("success", function(e) {
         e.clearSelection(); //清除选中的文字的选择状态
         that.$toast.success("ID复制成功~");

+ 56 - 93
src/view/course/user/courseAdDeal.vue

@@ -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;

+ 7 - 5
src/view/course/user/courseDeal.vue

@@ -263,13 +263,15 @@ img {
             padding: 0 0.2rem;
             margin-bottom: 0.15rem;
             p {
+              padding: .2rem 0;
               font-size: 0.3rem;
               color: #000;
-              line-height: 3;
-              overflow: hidden;
-              text-overflow: ellipsis;
-              white-space: nowrap;
-              word-break: break-all;
+              line-height: 1.3;
+              // line-height: 3;
+              // overflow: hidden;
+              // text-overflow: ellipsis;
+              // white-space: nowrap;
+              // word-break: break-all;
             }
           }
         }

+ 1 - 2
src/view/course/user/deal.vue

@@ -72,7 +72,6 @@
         <div class="dealList">
           <courseList :dataList="courseList" :listType="2"></courseList>
         </div>
-        <noData :list="courseList" />
       </scroller>
       <scroller
         ref="recordScroller"
@@ -379,7 +378,7 @@ export default {
         & > p {
           font-size: 0.28rem;
           color: #666;
-          line-height: 1;
+          line-height: 1.3;
         }
         & > span {
           font-size: 0.28rem;

+ 5 - 2
src/view/course/user/wxAuth.vue

@@ -1,6 +1,10 @@
 <template>
 <div>
-  <van-loading style="position: absolute;top: 10%;left: 50%;transform: translateX(-50%);" size="24px">请在微信端打开...</van-loading>
+  <div class="center"  style="position: absolute;top: 10%;left: 50%;transform: translateX(-50%);text-align: center;">
+    <van-loading size="24px" style="margin-bottom: .3rem;">请在微信端授权后再使用完整服务...</van-loading>
+    <van-button type="primary"  @click="init">授权获取完整服务</van-button>
+  </div>
+  
 </div>
 </template>
 
@@ -23,7 +27,6 @@ export default {
     }
   },
   created () { 
-    console.log(this.$route.query)
     this.init()
   },
   computed:{