From f77499fc9efabb27c8c9de31397b8084549db1ef Mon Sep 17 00:00:00 2001
From: IvyXia123 <ivyHsia@126.com>
Date: Wed, 4 Sep 2019 22:38:06 +0800
Subject: [PATCH] chess

---
 src/components/mine/index.vue         | 19 +++++++++--
 src/components/newLesson/evaluate.vue | 43 +++++++++++++++----------
 src/components/newLesson/share.vue    | 46 ++++++++++++++++++---------
 src/main.js                           |  6 ++--
 4 files changed, 76 insertions(+), 38 deletions(-)

diff --git a/src/components/mine/index.vue b/src/components/mine/index.vue
index 569eeccf..68d7e626 100644
--- a/src/components/mine/index.vue
+++ b/src/components/mine/index.vue
@@ -8,8 +8,8 @@
       </div>-->
       <div class="contentBox">
         <div class="left">
-          <img class="header-icon" :src="userDetail.avatar" />
-          <p class="name">{{userDetail.nickname}}</p>
+          <img class="header-icon" :src="avatarActive" />
+          <p class="name">{{ nicknameActive }}</p>
         </div>
         <div class="right">
           <p class="id">学员号:{{userDetail.user_id}}</p>
@@ -102,7 +102,9 @@ export default {
       phoneNumber: "",
       starNum: "",
       addressInfo: {},
-      acitivityType:1
+      acitivityType:1,
+      avatarActive: '',
+      nicknameActive: ''
     };
   },
   mounted() {
@@ -119,6 +121,17 @@ export default {
       // getUserAdressApi().then(res => {
       //   this.addressInfo = res;
       // });
+      getUserDetailApi()
+          .then(res => {
+            console.log(res)
+            this.avatarActive = res.avatar
+            this.nicknameActive = res.nickname
+            localStorage.setItem("userDesc", JSON.stringify(res));
+          })
+          .catch(res => {
+            if (localStorage.getItem("userDesc")) {
+            }
+          });
       getStarInfoApi().then(res =>{
         if(res.code==500){
           this.acitivityType = 2
diff --git a/src/components/newLesson/evaluate.vue b/src/components/newLesson/evaluate.vue
index b45bced3..9e38d5b4 100644
--- a/src/components/newLesson/evaluate.vue
+++ b/src/components/newLesson/evaluate.vue
@@ -28,7 +28,8 @@
       </ul>
       <!-- 输入框 -->
       <div class="checkbox-put">
-        <div contenteditable="true" class="checkbox-put-contenteditable" v-text="myHtmlCode" @input="handleInput" placeholder="点击输入宝贝今天的学习表现、收获…"></div>
+<!--        <div contenteditable="true" class="checkbox-put-contenteditable" v-text="myHtmlCode" @input="handleInput" placeholder="点击输入宝贝今天的学习表现、收获…"></div>-->
+        <textarea class="checkbox-put-contenteditable" v-model="myHtmlCode" @change="handleInput"></textarea>
         <div class="checkbox-text">*可输入15-100字</div>
       </div>
       <!-- btn -->
@@ -44,6 +45,7 @@
     <div v-if="shareShow">
       <share-page @closeShare="closeShare()" @backList="backList()" :route="query" :totalStarNum="totalStarNum"/>
     </div>
+    <audio ref="audioDom" id="audioDom" class="audio" :src="audioPoint"></audio>
   </div>
 </template>
 
@@ -53,6 +55,9 @@
   import growthRecord from "../../assets/growth_record.png";
   import { Toast } from "vant";
   import sharePage from "./share";
+  import audioGood from "../../assets/good.mp3";
+  import audioGreat from "../../assets/great.mp3";
+  import audioPerfect from "../../assets/perfect.mp3";
 
   export default {
     name: 'evaluate',
@@ -68,6 +73,7 @@
         shareShow: false,
         query: {},
         totalStarNum: 0,
+        audioPoint: "",
       }
     },
     components: {
@@ -91,7 +97,7 @@
       handleInput(e){
         let classQuery = JSON.parse(sessionStorage.getItem("classQuery"))
         let checkboxPutContenteditable = document.querySelector('.checkbox-put-contenteditable');
-        this.cache = Object.assign({}, this.cache, { inner: checkboxPutContenteditable.innerHTML, id: classQuery.elementId })
+        this.cache = Object.assign({}, { imageNum: this.imageNum, imageNum2: this.imageNum2, imageNum3: this.imageNum3, inner: this.myHtmlCode, id: classQuery.elementId })
         localStorage.setItem('cache', JSON.stringify(this.cache))
       },
       /**
@@ -118,20 +124,7 @@
             localStorage.removeItem("cache");
             // 展示网页生成图片
             this.shareShow = true
-
-            /*setTimeout(() => {
-              if (this.$store.state.lookStatus == 0) {
-                this.audioPoint = audioGood;
-              } else if (this.$store.state.lookStatus == 1) {
-                this.audioPoint = audioGreat;
-              } else {
-                this.audioPoint = audioPerfect;
-              }
-              this.$refs.audioDom.load();
-              setTimeout(() => {
-                this.$refs.audioDom.play();
-              }, 100);
-            }, 300);*/
+            this.audioFn()
 
             this.$sa.track('buttonClick',{
               tabTitle:'评价',
@@ -159,6 +152,22 @@
           buttonName:'提交成长记录不提交跳过'
         });
         this.shareShow = true
+        this.audioFn()
+      },
+      audioFn(){
+        setTimeout(() => {
+          if (this.$store.state.lookStatus == 0) {
+            this.audioPoint = audioGood;
+          } else if (this.$store.state.lookStatus == 1) {
+            this.audioPoint = audioGreat;
+          } else {
+            this.audioPoint = audioPerfect;
+          }
+          this.$refs.audioDom.load();
+          setTimeout(() => {
+            this.$refs.audioDom.play();
+          }, 100);
+        }, 300);
       },
       /**
        * 初始化
@@ -172,7 +181,7 @@
             this.imageNum   = cacheObj.imageNum || 0;
             this.imageNum2  = cacheObj.imageNum2 || 0;
             this.imageNum3  = cacheObj.imageNum3 || 0;
-            this.myHtmlCode = cacheObj.inner || '';
+            this.myHtmlCode = cacheObj.inner || 0;
           }else {
             localStorage.removeItem("cache");
           }
diff --git a/src/components/newLesson/share.vue b/src/components/newLesson/share.vue
index f7b34064..4fcd2377 100644
--- a/src/components/newLesson/share.vue
+++ b/src/components/newLesson/share.vue
@@ -19,10 +19,10 @@
               </div>
               <img class="shareTitle" :src="shareTitle" />
               <div class="head-block">
-                <img :src="userDetail.avatar" />
+                <img :src="avatarActive" />
               </div>
               <div class="content-title">
-                <span class>{{nickname}}</span>
+                <span class>{{nicknameActive}}</span>
                 <span>家宝宝</span>
               </div>
             </div>
@@ -89,16 +89,16 @@
             <img src="../../assets/icon_copy.png" alt />
             <p>以下学习心得,可复制粘贴到朋友圈啦!</p>
           </div>
-        <div class="pannel-main" v-html="htmlContent"></div>
-        <div class="pannel-footer">
+          <div class="pannel-main" v-html="htmlContent"></div>
+          <div class="pannel-footer">
             <span @click="changeText">
             <img :src="icon_change" alt=""> 换一换</span>
+          </div>
         </div>
-      </div>
-      <div @click="copyText" class='transparentBtn'>
-        复制心得
-      </div>
-    </div>-->
+        <div @click="copyText" class='transparentBtn'>
+          复制心得
+        </div>
+        </div>-->
       </div>
     </div>
     <img class="canvasImg" @touchstart="touchStart" @touchend="touchEnd" :src="canvasData" alt /> <!--  @touchstart="touchStart" -->
@@ -142,7 +142,8 @@
     getUserWatchApi,
     getShortApi,
     subUserLessonApi,
-    postErrorLogApi
+    postErrorLogApi,
+    getUserDetailApi
   } from "../../service/api";
   import share_code_bg from "../../assets/newLesson/share-code-bg.png";
   import img_logo from "../../assets/newLesson/logo@2x.png";
@@ -189,13 +190,28 @@
         dierkexing: dierkexing,  // 三颗星第一第三颗
         diyikexing: diyikexing,   // 第二课星
         starNum: 0,
+        avatarActive: '',
+        nicknameActive: ''
       };
     },
     props: ["route", "totalStarNum"],
     mounted() {
       // 判断星星
-      // this.starNum = JSON.parse(localStorage.getItem('lessonDetail')).star_num
-      // console.log(this.starNum)
+
+      getUserDetailApi()
+          .then(res => {
+            console.log(res)
+            this.avatarActive = res.avatar
+            this.nicknameActive = res.nickname
+            localStorage.setItem("userDesc", JSON.stringify(res));
+          })
+          .catch(res => {
+            if (localStorage.getItem("userDesc")) {
+            }
+          });
+
+      this.starNum = JSON.parse(localStorage.getItem('lessonDetail')).star_num
+      console.log(this.starNum)
       Toast.loading({
         mask: true,
         message: "",
@@ -1295,17 +1311,17 @@
   }
 
   .animated {
-    animation: mymove 1s .5s ease;
+    animation: mymove 1s .5s;
     animation-fill-mode: forwards;
   }
 
   .animated1 {
-    animation: mymove 1s 1s ease;
+    animation: mymove 1s 1s;
     animation-fill-mode: forwards;
   }
 
   .animated2 {
-    animation: mymove 1s 1.5s ease;
+    animation: mymove 1s 1.5s;
     animation-fill-mode: forwards;
   }
 
diff --git a/src/main.js b/src/main.js
index 93f143e5..82fb1d82 100644
--- a/src/main.js
+++ b/src/main.js
@@ -39,9 +39,9 @@ Vue.config.errorHandler = errorHandler;
 Vue.prototype.$throw = (error)=> errorHandler(error,this);
 Vue.prototype.$common = common
 //VConsole关闭屏蔽代码
-if (process.env.NODE_ENV != 'production') {
-  new VConsole();
-}
+// if (process.env.NODE_ENV != 'production') {
+//   new VConsole();
+// }
 
 router.beforeEach((to, from, next) => {
   next()
-- 
2.21.0