ming před 1 rokem
rodič
revize
40c96b3ea1
2 změnil soubory, kde provedl 0 přidání a 148 odebrání
  1. 0 57
      src/utils/jssdk.js
  2. 0 91
      src/utils/upgrade.js

+ 0 - 57
src/utils/jssdk.js

@@ -1,57 +0,0 @@
-import config from "@/config";
-
-//#ifdef H5
-const jweixin = import('weixin-js-sdk')
-//#endif
-export function configWeiXin(callback) {
-	const url = ""
-
-	//#ifdef H5
-	if (window.location.host) {
-		url = window.location.host;
-	}
-
-	if (uni.getStorageSync("serveUrl")) {
-		url = uni.getStorageSync("serveUrl");
-	}
-	//#endif
-
-	uni.request({
-		url: "https://qhome.usky.cn/USKYZHAF/sign.php",
-		header: {
-			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
-		},
-		data: {
-			"url": url
-		},
-		method: 'GET',
-		success: (res) => {
-			// console.log('请求的签名的参数')
-			// console.log(res)
-
-			let apiList = [ // 可能需要用到的能力 需要啥就写啥。多写也没有坏处
-				'openLocation',
-				'getLocation',
-				'scanQRCode'
-			];
-			let info = {
-				debug: false, // 调试,发布的时候改为false
-				appId: res.data.appid,
-				nonceStr: res.data.nonceStr,
-				timestamp: parseInt(res.data.timestamp),
-				signature: res.data.sha_str,
-				jsApiList: apiList
-			};
-
-			jweixin.config(info);
-			jweixin.error(err => {
-				alert('config fail:', err);
-				return
-			});
-
-			jweixin.ready(res => {
-				if (callback) callback(jweixin);
-			});
-		}
-	});
-}

+ 0 - 91
src/utils/upgrade.js

@@ -1,91 +0,0 @@
-
-/**
- * @description H5+下载App
- * @param downloadUrl:App下载链接
- * @param progressCallBack:下载进度回调
- */
-export const downloadApp = (downloadUrl, progressCallBack = () => { },) => {
-    return new Promise((resolve, reject) => {
-        //创建下载任务
-        const downloadTask = plus.downloader.createDownload(downloadUrl, {
-            method: "GET"
-        }, (task, status) => {
-            console.log(status, 'status')
-            if (status == 200) { //下载成功
-                resolve(task.filename)
-            } else {
-                reject('fail')
-                uni.showToast({
-                    title: '下载失败',
-                    duration: 1500,
-                    icon: "none"
-                });
-            }
-        })
-        //监听下载过程
-        downloadTask.addEventListener("statechanged", (task, status) => {
-            switch (task.state) {
-                case 1: // 开始  
-                    break;
-                case 2: //已连接到服务器  
-                    break;
-                case 3: // 已接收到数据  
-                    let hasProgress = task.totalSize && task.totalSize > 0 //是否能获取到App大小
-                    if (hasProgress) {
-                        let current = parseInt(100 * task.downloadedSize / task.totalSize); //获取下载进度百分比
-                        progressCallBack(current)
-                    }
-                    break;
-                case 4: // 下载完成       
-                    break;
-            }
-        });
-        //开始执行下载
-        downloadTask.start();
-    })
-
-
-}
-/**
- * @description H5+安装APP
- * @param fileName:app文件名
- * @param callBack:安装成功回调
- */
-export const installApp = (fileName, callBack = () => { }) => {
-    //注册广播监听app安装情况
-    onInstallListening(callBack);
-    //开始安装
-    plus.runtime.install(plus.io.convertLocalFileSystemURL(fileName), {}, () => {
-        //成功跳转到安装界面
-    }, function (error) {
-        uni.showToast({
-            title: '安装失败',
-            duration: 1500,
-            icon: "none"
-        });
-    })
-
-}
-/**
- * @description 注册广播监听APP是否安装成功
- * @param callBack:安装成功回调函数
- */
-const onInstallListening = (callBack = () => { }) => {
-
-    let mainActivity = plus.android.runtimeMainActivity(); //获取activity
-    //生成广播接收器
-    let receiver = plus.android.implements('io.dcloud.android.content.BroadcastReceiver', {
-        onReceive: (context, intent) => { //接收广播回调  
-            plus.android.importClass(intent);
-            mainActivity.unregisterReceiver(receiver); //取消监听
-            callBack()
-        }
-    });
-    let IntentFilter = plus.android.importClass('android.content.IntentFilter');
-    let Intent = plus.android.importClass('android.content.Intent');
-    let filter = new IntentFilter();
-    filter.addAction(Intent.ACTION_PACKAGE_ADDED); //监听APP安装     
-    filter.addDataScheme("package");
-    mainActivity.registerReceiver(receiver, filter); //注册广播
-
-}