Przeglądaj źródła

fix: TPage气球

lvkun996 2 lat temu
rodzic
commit
724508df13

+ 4 - 0
.env.development

@@ -0,0 +1,4 @@
+NODE_ENV='development'
+VUE_APP_FLAG='dev'
+VUE_APP_URL='/zd-api/'
+VUE_APP_JUMP='https://zaojiao.net/luojigou_web_shop_html/#/'

+ 4 - 0
.env.production

@@ -0,0 +1,4 @@
+NODE_ENV='production'
+VUE_APP_FLAG='pro'
+VUE_APP_URL='/zd-api/'
+VUE_APP_JUMP='https://zaojiao.net/luojigou_web_shop_html/#/'

+ 1 - 0
components.d.ts

@@ -8,6 +8,7 @@ export {}
 declare module '@vue/runtime-core' {
   export interface GlobalComponents {
     LuojigouBoard: typeof import('./src/components/LuojigouBoard/index.vue')['default']
+    OpenApp: typeof import('./src/components/OpenApp/index.vue')['default']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
     VanProgress: typeof import('vant/es')['Progress']

BIN
dist.zip


+ 5 - 0
package-lock.json

@@ -13748,6 +13748,11 @@
       "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
       "dev": true
     },
+    "weixin-js-sdk": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.0.tgz",
+      "integrity": "sha512-3IYQH7aalJGFJrwdT3epvTdR1MboMiH7vIZ5BRL2eYOJ12BNah7csoMkmSZzkq1+l92sSq29XdTCVjCJoK2sBQ=="
+    },
     "which": {
       "version": "1.3.1",
       "resolved": "https://registry.npmmirror.com/which/-/which-1.3.1.tgz",

+ 3 - 2
package.json

@@ -6,7 +6,7 @@
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
     "lint": "vue-cli-service lint",
-    "upload:pro": "python upload.py /usr/share/nginx/html/luojigou/ app_web pro",
+    "upload:pro": "python upload.py /usr/share/nginx/html/zaojiao/ app_web pro",
     "upload:dev": "python upload.py /usr/share/nginx/html/ app_web dev"
   },
   "dependencies": {
@@ -24,7 +24,8 @@
     "vconsole": "^3.15.0",
     "vue": "^3.0.0",
     "vue-class-component": "^8.0.0-0",
-    "vue-router": "^4.0.0-0"
+    "vue-router": "^4.0.0-0",
+    "weixin-js-sdk": "^1.6.0"
   },
   "devDependencies": {
     "@typescript-eslint/eslint-plugin": "^4.18.0",

+ 12 - 0
src/api/common.ts

@@ -0,0 +1,12 @@
+import request from '@/service/index'
+
+// 获取c端微信签名
+export function getWXSignature() {
+  let url = window.location.href.split('#')[0];
+  // let url = `https://luojigou.vip/app_web`;
+  return request({
+    url: `app/wx/sign`,
+    method: 'GET',
+    params: {url},
+  });
+}

+ 72 - 0
src/components/OpenApp/index.vue

@@ -0,0 +1,72 @@
+<template>
+  <!-- position:absolute;left:0;top:0;width:100%;height:100% -->
+  <div class="wx-open-app">
+    <wx-open-launch-app
+      id="launch-btn"
+      ref="launchBtnRef"
+      :appid="state.appid"
+      :extinfo="state.extinfo"
+      @ready="handleReadyFn"
+    >
+      <div v-is="'script'" type="text/wxtag-template" >
+        <div
+          class="btn"
+            style="
+            width: 334px;
+            height: 52px;
+            background: #FF8024;
+            border-radius: 26px;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            font-size: 18px;
+            font-family: PingFangSC-Regular, PingFang SC;
+            font-weight: 400;
+            color: #FFFFFF;
+          "
+          >
+            打开APP
+        </div>
+      </div>
+    </wx-open-launch-app>
+  </div>
+</template>
+
+<script lang="ts" setup >
+import { reactive } from 'vue';
+import { ref } from 'vue'
+
+// export interface IProps {
+//   appid?: string
+//   extinfo?: string
+// }
+// wxe87236d542cd0f94 // wxeb44a864bdd935be // wxd61f929a1c72280a
+const state = reactive({
+  appid: 'wxeb44a864bdd935be',
+  extinfo: ''
+})
+
+const launchBtnRef = ref()
+
+const handleReadyFn = () => {
+
+    launchBtnRef.value.addEventListener("launch", function () {
+      console.log('launch');
+    });
+
+    launchBtnRef.value.addEventListener("error", function (e: any) {
+      console.log('error:', e.detail);
+      window.location.href = `https://sj.qq.com/myapp/detail.htm?apkName=com.zaojiao.app`;
+    });
+
+}
+
+
+</script>
+ 
+<style  >
+
+
+</style>
+
+

+ 8 - 21
src/hook/index.ts

@@ -86,7 +86,6 @@ export const useAudioManager: UseAudioManager = ({
     fco.pause = window.$audio.pause
     return [fco, window.$audio]
   } else {
-    console.log('initAudio');
     
     const atx = new Audio(url)
 
@@ -106,8 +105,6 @@ export const useAudioManager: UseAudioManager = ({
 
     // ios 下new audio获取音频时长问题
     atx.onloadedmetadata = () => {
-      console.log('/ ios 下new audio获取音频时长问题:',  dayjs(Math.round(atx.duration) * 1000).format(format));
-      
       fco.duration = dayjs(Math.round(atx.duration) * 1000).format(format)
     }
 
@@ -150,21 +147,15 @@ export const useAudioManager: UseAudioManager = ({
       fco.pause && fco.pause()
     })
 
-    watch(
-      () => fco.src,
-      () => {
-        console.log('我触发吗');
+    // watch(
+    //   () => fco.src,
+    //   () => {
+    //     console.log('我触发吗');
         
-        atx.muted = true
-        atx.play().then(() => atx.pause())
-      }
-    )
-
-    onMounted(() => {
-
-     
-
-    })
+    //     atx.muted = true
+    //     atx.play().then(() => atx.pause())
+    //   }
+    // )
 
     return [fco, window.$audio]
   }
@@ -355,16 +346,12 @@ export const useLocalStorage = (key: string): [any, (value: any) => void] => {
     if (typeof value == 'object') {
       window.localStorage.setItem(key, JSON.stringify(value))
     } else if (typeof value == 'string') {
-      console.log('set:', value);
-      
       window.localStorage.setItem(key, value)
     }  
   }
 
   const _get = () => {
     const r = window.localStorage.getItem(key)
-    console.log("_getToken:", r);
-    
     try {
       value = JSON.parse(r!)
     } catch (error) {

+ 6 - 4
src/pages/LearnPlan/components/AbleChart.vue

@@ -3,11 +3,10 @@
   <div class="able-chart" >
     <div class="title" >{{props.title}}</div>
     <div class="able" >
-      <div class="able-item" v-for="item in 6" :key="item" >
+      <div class="able-item" v-for="(item) in 6" :key="item" >
         <img
           :src=" item > props.count ?  staticImg.ableGrey : staticImg.able" alt=""
         >
-
       </div>
     </div>
     <img class="study" v-if="index === 0" :src="require('@/assets/component/LuojigouBoard/study1.png')" />
@@ -36,16 +35,17 @@ const props = defineProps<IProps>()
 <style scoped lang="scss" >
 .able-chart {
   width: 303px;
-  height: 46px;
+  height: 64px;
   background: #FDF8F5;
   border-radius: 10px;
   padding: 0 16px;
   box-sizing: border-box;
   display: flex;
   justify-content: space-between;
-  align-items: center;
   background: url('~@/assets/component/LuojigouBoard/rect.png') no-repeat top left;
   position: relative;
+  background-size: 100%;
+  padding-top: 30px;
   .title {
     font-size: 14px;
     font-family: PingFangSC-Medium, PingFang SC;
@@ -56,6 +56,8 @@ const props = defineProps<IProps>()
     position: absolute;
     top: 0;
     left: 0;
+    width: 79px;
+    height: 14px;
   }
   .able {
     display: flex;

+ 164 - 156
src/pages/LearnPlan/views/LearnReport/index.vue

@@ -1,176 +1,176 @@
 <template>
   <div class="learn-report-container" >
     <div class="learn-report" id="learn-report" :ref="learnReportRef" >
-    <div class="learn-report-bg">
-      <img class="bg" :src="staticImg.learnReportBg" alt="">
-      <img class="title-img" :src="staticImg.titleImg" alt="">
-      <div class="user-name" >{{state.report?.userNickName || '逻辑狗'}}</div>
-    </div>
+        <div class="learn-report-bg">
+          <img class="bg" :src="staticImg.learnReportBg" alt="">
+          <img class="title-img" :src="staticImg.titleImg" alt="">
+          <div class="user-name" >{{state.report?.userNickName || '逻辑狗'}}</div>
+        </div>
 
-    <div class="learn-report-content" >
-      <!-- 学习天数 -->
-    <div class="learn-day" v-if="posterShowState" >
-      <div class="user-ava" >
-        <img :src="staticImg.learnReportBg" alt="">
-      </div>
-      <div class="user-name" >{{state.report?.userNickName}}</div>
-      <div class="learn-day-desc" >
-        <div>我家宝贝已经连续学习<span>{{state.report?.totalStudyDays}}</span>天了</div>
-        <div>快来一起学习吧</div>
+      <div class="learn-report-content" >
+        <!-- 学习天数 -->
+      <div class="learn-day" v-if="posterShowState" >
+        <div class="user-ava" >
+          <img :src="staticImg.learnReportBg" alt="">
+        </div>
+        <div class="user-name" >{{state.report?.userNickName}}</div>
+        <div class="learn-day-desc" >
+          <div>我家宝贝已经连续学习<span>{{state.report?.totalStudyDays}}</span>天了</div>
+          <div>快来一起学习吧</div>
+        </div>
       </div>
-    </div>
 
-    <!-- 学习展示 -->
-    <div class="learn-preview" :style="{marginTop: posterShowState ? '16px' : '-16px'}" >
-      <div class="learn-preview-data" >
-        <div class="data-item"  >
-          <div class="staticsc" >
-            <span>{{state.report?.totalDuration ? Math.floor( state.report?.totalDuration! / 60) : 0 }}</span>            
-            <div class="unit" >分钟</div>
-          </div>  
-          <div class="data-item-desc" >
-            累计时长
+      <!-- 学习展示 -->
+      <div class="learn-preview" :style="{marginTop: posterShowState ? '16px' : '-16px'}" >
+        <div class="learn-preview-data" >
+          <div class="data-item"  >
+            <div class="staticsc" >
+              <span>{{state.report?.totalDuration ? Math.floor( state.report?.totalDuration! / 60) : 0 }}</span>
+              <div class="unit" >分钟</div>
+            </div>
+            <div class="data-item-desc" >
+              累计时长
+            </div>
           </div>
-        </div>
-        <div class="data-item"  >
-          <div class="staticsc" >
-            <span>{{state.report?.totalStars}}</span>
-        
-            <div class="unit" >颗</div>
+          <div class="data-item"  >
+            <div class="staticsc" >
+              <span>{{state.report?.totalStars}}</span>
+              <div class="unit" >颗</div>
+            </div>
+            <div class="data-item-desc" >
+              获得星数
+            </div>
           </div>
-          <div class="data-item-desc" >
-            获得星数
+          <div class="data-item"  >
+            <div class="staticsc" >
+              <span>{{state.report?.accuracy}}</span>
+              <div class="unit" >%</div>
+            </div>
+            <div class="data-item-desc" >
+              正确率
+            </div>
           </div>
         </div>
-        <div class="data-item"  >
-          <div class="staticsc" >
-            <span>{{state.report?.accuracy}}</span>
-            <div class="unit" >%</div>
+        <div class="decator" >
+          <img :src="staticImg.decator" alt="">
+        </div>
+        <div class="audio-play-container" 
+          :style="{backgroundImage: `url(${state.report?.task3Image}`}"
+        >
+          <div v-if="!fco.playing" class="audio-time-total" >
+            {{fco.duration}}
           </div>
-          <div class="data-item-desc" >
-            正确率
+          <div class="play-button" @click="playAudio" v-if="!fco.playing">
+            <img :src="staticImg.playButton" alt="">
           </div>
-        </div>
-      </div>
-      <div class="decator" >
-        <img :src="staticImg.decator" alt="">
-      </div>
-      <div class="audio-play-container" 
-        :style="{backgroundImage: `url(${state.report?.task3Image}`}"
-      >
-        <div v-if="!fco.playing" class="audio-time-total" >
-          {{fco.duration}}
-        </div>
-        <div class="play-button" @click="playAudio" v-if="!fco.playing">
-          <img :src="staticImg.playButton" alt="">
-        </div>
 
-        <div class="play-process" ref="playProcessRef"   v-show="fco.playing" >
-          <van-progress
-            @click="updatePercentage"
-            class="van-progress"
-            :percentage="Number(fco.percentage.toFixed(2)) * 100"
-            pivot-color="#FF8024"
-            color="#FF8024"
-            pivot-text=" "
-            track-color="#EDEDED"
-          />
-          <div class="play-time-process" >
-            {{fco.updateTime}}/{{fco.duration}}
+          <div class="play-process" ref="playProcessRef"   v-show="fco.playing" >
+            <van-progress
+              @click="updatePercentage"
+              class="van-progress"
+              :percentage="Number(fco.percentage.toFixed(2)) * 100"
+              pivot-color="#FF8024"
+              color="#FF8024"
+              pivot-text=" "
+              track-color="#EDEDED"
+            />
+            <div class="play-time-process" >
+              {{fco.updateTime}}/{{fco.duration}}
+            </div>
           </div>
         </div>
-      </div>
 
-      <div class="learn-preview-desc"  v-if="posterShowState" >
-        长按扫描二维码,一起查看~
-      </div>
+        <div class="learn-preview-desc"  v-if="posterShowState" >
+          长按扫描二维码,一起查看~
+        </div>
 
-    </div>
-    <!-- v-if="state.report?.exerciseCardResultList"  -->
-    <!-- 练习分析 -->
-    <div class="learn-any learn-modle" >
-      <div class="learn-modle-title" >
-        <img :src="staticImg.learnAny" alt="">
-        <div class="learn-title" >今日练习分析</div>
-      </div>
-      <div class="able-any" >
-        <able-chart
-          style="margin-bottom: 12px;"
-          :title="item.capability"
-          :index="index"
-          :count="item.correctQuantity"
-          v-for="(item, index) in state.report?.exerciseCardResultList"
-          :key="item.capability"
-        />
       </div>
-    </div>
- 
-    <!-- 家园共育策略 -->
-    <div class="home-strategy learn-modle" >
-      <div class="learn-modle-title" >
-        <img :src="staticImg.strategy" alt="">
-        <div class="learn-title" >亲子游戏策略</div>
+      <!-- v-if="state.report?.exerciseCardResultList"  -->
+      <!-- 练习分析 -->
+      <div class="learn-any learn-modle" >
+        <div class="learn-modle-title" >
+          <img :src="staticImg.learnAny" alt="">
+          <div class="learn-title" >今日练习分析</div>
+        </div>
+        <div class="able-any" >
+          <able-chart
+            style="margin-bottom: 12px;"
+            :title="item.capability"
+            :index="index"
+            :count="item.correctQuantity"
+            v-for="(item, index) in state.report?.exerciseCardResultList"
+            :key="item.capability"
+          />
+        </div>
       </div>
-      <div class="strategy" >
-        <div class="strategy-item" 
-          v-for="item in state.report?.teachDescription.split('\n').splice(0, state.report?.teachDescription.split('\n').length)" 
-          :key="item"
-        >
-          <div class="dot" ></div>
-          <div class="text-content" >
-            {{item}}
+  
+      <!-- 家园共育策略 -->
+      <div class="home-strategy learn-modle" >
+        <div class="learn-modle-title" >
+          <img :src="staticImg.strategy" alt="">
+          <div class="learn-title" >亲子游戏策略</div>
+        </div>
+        <div class="strategy" >
+          <div class="strategy-item"
+            v-for="item in state.report?.teachDescription.split('\n').splice(0, state.report?.teachDescription.split('\n').length)"
+            :key="item"
+          >
+            <div class="dot" ></div>
+            <div class="text-content" >
+              {{item}}
+            </div>
           </div>
         </div>
-      </div>
-      <div class="qrcode" v-show="posterShowState">
-        <div class="qrcode-img" >
-          <img :src="qrcode" alt="">
+        <div class="qrcode" v-show="posterShowState">
+          <div class="qrcode-img" >
+            <img :src="qrcode" alt="">
+          </div>
+          <div class="qrcode-info" >
+            <div class="qrcode-title"> 逻辑狗·一起成长 </div>
+            <div class="qrcode-desc">识别二维码,让你家宝贝也来体验吧 </div>
+          </div>
         </div>
-        <div class="qrcode-info" >
-          <div class="qrcode-title"> 逻辑狗·一起成长 </div>
-          <div class="qrcode-desc">识别二维码,让你家宝贝也来体验吧 </div>
+      </div>
+
+      <!-- 生成报告 -->
+      <div class="create-poster" v-if="!posterShowState" >
+        <open-app v-if="queryParams.share == 1" />
+        <div v-else class="create-button"  @click="openModal">
+          <div class="text" >晒报告 <span v-if="!state.shared" >+5</span> </div>
+          <img v-if="!state.shared" :src="staticImg.dogCoin" alt="">
         </div>
       </div>
-    </div>
 
-    <!-- 生成报告 -->
-    <div class="create-poster" v-if="!posterShowState" >
-      <div class="create-button" @click="openModal">
-        <div class="text" >晒报告   <span v-if="!state.shared" >+5</span> </div>
-        <img v-if="!state.shared" :src="staticImg.dogCoin" alt="">
+      <!-- 底部图片 -->
+      <div class="learn-report-decator" v-if="posterShowState"  >
+        <img :src="staticImg.learnReportDecator" alt="">
+      </div>
       </div>
-    </div>
 
-    <!-- 底部图片 -->
-    <div class="learn-report-decator" v-if="posterShowState"  >
-      <img :src="staticImg.learnReportDecator" alt="">
     </div>
-    </div>
-
-  </div>
 
       <Overlay :show="posterShowState" class="van-overlay" :lock-scroll="false"  :z-index="10"  @click="posterShowState = false">
-        <div class="wrapper">
-          <div  class="poster-container" id="learnReportRef"></div>
-        </div>
+          <div class="wrapper">
+            <div  class="poster-container" id="learnReportRef"></div>
+          </div>
       </Overlay>
 
       <ActionSheet :overlay="false" :show="posterShowState" :closeable="false" :z-index="11" title="晒报告">
-        <div class="share-dialog" >
-          <div class="share-content" >
-            <div class="share-item" @click.stop="savePoster">
-              <img :src="staticImg.photo" alt="">
-              <span>保存海报</span>
+          <div class="share-dialog" >
+            <div class="share-content" >
+              <div class="share-item" @click.stop="savePoster">
+                <img :src="staticImg.photo" alt="">
+                <span>保存海报</span>
+              </div>
+              <div class="share-item" @click.stop="shareWx">
+                <img :src="staticImg.wechat" alt="">   
+                <span>微信好友</span>
+              </div>
             </div>
-            <div class="share-item" @click.stop="shareWx">
-              <img :src="staticImg.wechat" alt="">
-              <span>微信好友</span>
+            <div class="cancel-butuon" @click="closeModal" >
+              取消
             </div>
           </div>
-          <div class="cancel-butuon" @click="closeModal" >
-            取消
-          </div>
-        </div>
       </ActionSheet>
   </div>
 
@@ -178,19 +178,21 @@
 
 <script setup lang="ts">
 
-import { ref, nextTick, onMounted, computed, watch, reactive, getCurrentInstance } from 'vue'
-import { useAudioManager, useSchedulerOnce } from '@/hook/index'
+import { ref, nextTick, onMounted, reactive } from 'vue'
+import { useAudioManager } from '@/hook/index'
 import AbleChart from '../../components/AbleChart.vue'
 import { screenShot, createQrcode } from '@/utils/utils'
 import { getReportByUser, shareUserReport } from "@/api/learnPlan"
 import { useRoute } from 'vue-router'
 import { useAppRouter, useAppFunc } from '@/hook/appHook'
-import { useTokenStore } from '@/store'
-import  { Button, Overlay, ActionSheet } from 'vant'
+import { Overlay, ActionSheet } from 'vant'
+import OpenApp from '@/components/OpenApp/index.vue'
+import { registerWxopenButton } from '@/utils/utils'
 
 export interface QueryParams {
   i: string,
-  u?: string
+  u?: string,
+  share?: number
 }
 
 const staticImg = {
@@ -213,8 +215,14 @@ const [fco, atx] = useAudioManager({
 
 const queryParams = useRoute().query as unknown as QueryParams
 
-queryParams.i = "1630466274125459458"
-queryParams.u = "1430026961974345730"
+console.log('timeStamp');
+
+
+console.log('queryParams:', queryParams);
+
+
+// queryParams.i = "1630466274125459458"
+// queryParams.u = "1430026961974345730"
 
 const posterScaleRate = ref(window.screen.width / window.screen.height > 0.7 ? 0.22 : 0.3)
 
@@ -237,8 +245,6 @@ const learnReportRef = ref('')
 const posterblob = ref('')
 
 const playAudio = () => {
-  console.log(Array.from(document.getElementsByClassName('van-progress__pivot'))[0].getBoundingClientRect());
-  
   fco.play()
 }
 
@@ -311,18 +317,18 @@ const shareWx = () => {
 
 // 获取用户报告信息
 const _getReportByUser = async () => {
+  
   const { data } = await getReportByUser({ "itemId": queryParams.i, "userId": queryParams.u! })
+
   fco.src = data.report.userLearnShareAudio
   state.report = data.report
   userId.value = data.userId
+
   getQrcodeUrl()
 }
 
 const createPoster = async () => {
-  console.log(posterScaleRate.value);
-  
   nextTick(async () => {
-    console.log(learnReportRef.value);
     const target = document.getElementById('learnReportRef')!
     if (Array.from(target!.children).length === 0) {
       const posterEl = await screenShot('learn-report')
@@ -331,19 +337,18 @@ const createPoster = async () => {
       target.append(posterEl)
       state.shared = 1
     }
-  })
+  }) 
 
 }
 
 const getQrcodeUrl = async () => {
-  qrcode.value = await createQrcode(queryParams.u ? window.location.href :  `${window.location.href}&u=${userId.value}`)
+  
+  qrcode.value = await createQrcode(queryParams.u ? window.location.href + `&share=1` :  `${window.location.href}&u=${userId.value}&share=1`)
 }
 
 onMounted(async () => {
 
-  // fco.src = 'https://app-resources-luojigou.luojigou.vip/61b092e0-ed4d-11ed-b1c6-f74dbdb881ba'
-  // console.log(fco.src);
-  
+
   if (queryParams.u) {
    _getReportByUser()
   } else {
@@ -351,9 +356,9 @@ onMounted(async () => {
    _getReportByUser()
   }
 
-  initAudioDragEvent()
-
+  registerWxopenButton()
 
+  initAudioDragEvent()
 
 })
 
@@ -734,6 +739,9 @@ onMounted(async () => {
     z-index: 3;
     padding-top: 9px;
     box-sizing: border-box;
+    display: flex;
+    align-items: flex-start;
+    justify-content: center;
     .create-button {
       width: 334px;
       height: 52px;

+ 8 - 5
src/pages/LearnPlan/views/TPage/index.vue

@@ -107,11 +107,11 @@ const a = new Rive({
 
 }
 
-// direChange((_dire) => {
-//   console.log('触发了方向')
-//   document.documentElement.style.fontSize = '37.5px'
-//   dire.value = _dire
-// })
+direChange((_dire) => {
+  console.log('触发了方向')
+  document.documentElement.style.fontSize = '37.5px'
+  dire.value = _dire
+})
 
 const [stx] = useScheduler({
   cb: () => {
@@ -247,8 +247,11 @@ onMounted(() => {
     position: absolute;
     height: 1px;
     width: 100%;
+  
   }
   #rive-ani {
+    position: absolute;
+    top: -200px;
   }
   .countdown-container {
     position: absolute;

+ 2 - 1
src/service/request.ts

@@ -2,7 +2,8 @@ import { useTokenStore } from '@/store'
 import axios, { AxiosResponse } from 'axios'
 
 
-const baseURL = process.env.NODE_ENV === 'development' ? '/api' : '/zd-api'
+// const baseURL = process.env.NODE_ENV === 'development' ? '/api' : '/zd-api'
+const baseURL = process.env.NODE_ENV === 'development' ? 'https://open.api.luojigou.vip/' : '/zd-api'
 // const baseURL = process.env.NODE_ENV === 'development' ? '/https://open.api.luojigou.vip/' : '/zd-api'
 
 // 'https://open.api.luojigou.vip/'

+ 2 - 0
src/typeing.d.ts

@@ -1,3 +1,5 @@
+declare module 'weixin-js-sdk'
+
 declare namespace API {
 
 

+ 36 - 0
src/utils/utils.ts

@@ -1,6 +1,8 @@
 import html2canvas from 'html2canvas'
 import QRCode from 'qrcode'
 import { ScreenShot } from './typing'
+import { getWXSignature } from '@/api/common'
+import wx from 'weixin-js-sdk'
 
 /**
  * @description 屏幕截图
@@ -27,6 +29,8 @@ export const screenShot: ScreenShot = async (el) => {
 }
 
 export const createQrcode = (text: string): Promise<string> => {
+  console.log('text:', text);
+  
   return new Promise((resolve) => {
     QRCode.toDataURL(text, { errorCorrectionLevel: 'H' }, function (err, url) {
       if (err) {
@@ -37,3 +41,35 @@ export const createQrcode = (text: string): Promise<string> => {
     })
   })
 }
+
+
+/**
+ * @description 注册wx-open-launch-app
+ */
+
+export async function registerWxopenButton() {
+  return new Promise(async resolve => {
+    const {data} = await getWXSignature();
+    console.log('register: wxopenButto:', data);
+    
+ 
+      const {signature, appId, nonceStr, timestamp} = data;
+      wx.config({
+        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印
+        appId, // 必填,公众号的唯一标识
+        timestamp, // 必填,生成签名的时间戳
+        nonceStr, // 必填,生成签名的随机串
+        signature,// 必填,签名
+        jsApiList: ['openLocation', 'getLocation'], // 必填,需要使用的JS接口列表
+        openTagList: ['wx-open-launch-app'] // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']
+      });
+      wx.error((res: any) => {
+        console.log(res);
+      });
+
+      wx.ready(() => {
+        resolve(true);
+      });
+   
+  });
+}

+ 0 - 1
upload.py

@@ -62,7 +62,6 @@ remote_file_name = remote_path + target_file_name
 print("本地文件地址: " + local_path )
 print("远程目录地址: " + remote_file_name)
 
-
 srmdir_all_folder = os.getcwd() + '/dist'  # 文件夹路径
 
 zip_file_path = srmdir_all_folder + ".zip"  # 压缩文件路径