7 Commits

  1. 6
      app/build.gradle
  2. 2
      app/src/main/assets/apps/__UNI__3B4D40B/www/app-service.js
  3. 2
      daemonlibrary/src/main/java/com/shihoo/daemon/Daemon_Uni.java
  4. 29
      daemonlibrary/src/main/java/com/shihoo/daemon/watchdog/DaemonHelper.java
  5. 2
      uniapp_project_code/src/components/index/keyboard/input_box_QR.vue
  6. 7
      uniapp_project_code/src/pages/index/index.vue
  7. 7
      uniapp_project_code/src/pages/index/standby.vue
  8. 4
      uniapp_project_code/src/pages/login/index.vue
  9. 62
      uniapp_project_code/src/pages/login/mixins/watchDogCompositionAPI.js
  10. 74
      uniapp_project_code/src/pages/login/mixins/watchDogOptionsAPI.js
  11. 2
      uniapp_project_code/src/utils/api.js

6
app/build.gradle

@ -8,8 +8,10 @@ android {
minSdkVersion 21
targetSdkVersion 28 //21 io.dcloud.PandoraEntry apk入口时 targetSDKVersion>=21
versionCode 118
versionName "1.1.8"
versionCode 121
versionName "1.2.1"
multiDexEnabled true
ndk {
// abiFilters 'x86','armeabi-v7a'

2
app/src/main/assets/apps/__UNI__3B4D40B/www/app-service.js
File diff suppressed because it is too large
View File

2
daemonlibrary/src/main/java/com/shihoo/daemon/Daemon_Uni.java

@ -34,7 +34,7 @@ public class Daemon_Uni extends UniModule {
* */
@UniJSMethod(uiThread = true)
public void startWatchDog(JSONObject options, UniJSCallback callback) {//
Daemon_UniAppProxy.daemonHelper.startWatchDogUni();
Daemon_UniAppProxy.daemonHelper.startWatchDog();
JSONObject data = new JSONObject();
Boolean isOn = Daemon_UniAppProxy.daemonHelper.isRestartApp();
data.put("code", isOn);

29
daemonlibrary/src/main/java/com/shihoo/daemon/watchdog/DaemonHelper.java

@ -53,8 +53,19 @@ public class DaemonHelper {
/**
* 在uniapp启动守护进程
*/
public void startWatchDogUni(){
startWatchDog(my_application);
public void startWatchDog(){
// startWatchDog(my_application);
Log.d(TAG, "startWatchDog: 开启守护进程");
startRestartApp();
}
/**
* 关闭守护进程
*/
public void closeWatchDog() {
Log.d(TAG, "closeWatchDog: 关闭守护进程");
// stopDaemonEnv();
// cancelDaemonEnvJob();
stopRestartApp();
}
/**
@ -115,15 +126,7 @@ public class DaemonHelper {
buildNotify(application);
}
/**
* 关闭守护进程
*/
public void closeWatchDog() {
Log.d(TAG, "closeWatchDog: 关闭守护进程");
// stopDaemonEnv();
// cancelDaemonEnvJob();
stopRestartApp();
}
/**
* 停止在守护进程中重启APP
@ -133,6 +136,10 @@ public class DaemonHelper {
mainWorkService.isNeedRestartApp = false;
}
private void startRestartApp(){
mainWorkService.isNeedRestartApp = true;
}
/**
* 调用MainWorkService的stopWork方法
*

2
uniapp_project_code/src/components/index/keyboard/input_box_QR.vue

@ -99,7 +99,7 @@
let {brand_id,stadium_id,token} = util.getPostParams()
let urlParams = {
brand_id,token,
brand_id,token,stadium_id,
"sku": sku,
}
console.log("searchGoodBySku urlParams:", urlParams)

7
uniapp_project_code/src/pages/index/index.vue

@ -140,6 +140,7 @@
// // console.log("skulist:", this.shopList)
// })
this.setFooterHeight()
// this.setTestSku() //sku
}, 1000)
},
methods: {
@ -147,7 +148,7 @@
util.showLoad()
let {brand_id,stadium_id,token} = util.getPostParams()
let urlParams = {
brand_id,token,
brand_id,token,stadium_id,
"sku": sku,
}
console.log("searchGoodBySku urlParams:", urlParams)
@ -190,7 +191,7 @@
},
async setTestSku() {
console.log("Test set SKU 10000012")
let skulist = await this.searchGoodBySku("10000012")
let skulist = await this.searchGoodBySku("6934024512123")
this.shopList = this.shopList.concat(skulist)
},
async clickToPay() {
@ -386,7 +387,7 @@
return res
}).catch(err => {
console.log("searchGoodBySku err: ", err)
util.showNone("未找到商品")
util.showNone(err.res.data?.message||"未找到商品-i")
})
//skulistshopList
if(skulist&&skulist.length>0)this.shopList = this.combinedList(this.shopList, skulist)

7
uniapp_project_code/src/pages/index/standby.vue

@ -83,7 +83,7 @@ export default {
},
async onReady() {
// this.screenHeight = await util.getPageHeight()
console.log(`the index page onReady----` + this.screenHeight)
console.log(`the index page onReady----` + this.screenHeight,uni.getStorage("stadiumInfo"))
app = getApp();
setTimeout(async () => {
// await this.updateGoodsList().then(async () => {
@ -100,7 +100,7 @@ export default {
searchGoodBySku: async (sku) => {
let {brand_id,stadium_id,token} = util.getPostParams()
let urlParams = {
brand_id,token,
brand_id,token,stadium_id,
"sku": sku,
}
console.log("searchGoodBySku urlParams:", urlParams)
@ -174,7 +174,8 @@ export default {
// return skulist
}).catch(err => {
console.log("searchGoodBySku err: ", err)
util.showNone("未找到商品")
// util.showNone("")
util.showNone(err.res.data?.message||"未找到商品-s")
})
//skulistshopList
// this.shopList = this.combinedList(this.shopList, skulist)

4
uniapp_project_code/src/pages/login/index.vue

@ -17,6 +17,7 @@
<view class="li-btn">
<login-button @click="clickLogin">登录</login-button>
<login-button @click="selectDaemon" style="margin-top: 20rpx;">进程守护设置</login-button>
</view>
</view>
@ -48,12 +49,13 @@
} from 'vue'
import { onLoad,onReady } from '@dcloudio/uni-app';
import md5 from '@/utils/md5.js'
import {useWatchDog} from './mixins/watchDogCompositionAPI.js';
onReady(async () => {
autoLogin()
});
// import { uni } from '@dcloudio/uni-h5';
const { isDaemonRun, selectDaemon, daemonRun } = useWatchDog();//API
const username = ref('');
const password = ref('');

62
uniapp_project_code/src/pages/login/mixins/watchDogCompositionAPI.js

@ -0,0 +1,62 @@
// useWatchDog.js
import { ref } from 'vue';
// #ifdef APP-PLUS
const Daemon_Uni = uni.requireNativePlugin('Daemon_Uni');
// #endif
export function useWatchDog() {
const isDaemonRun = ref(false); // 进程守护状态
// 异步函数来开启或关闭守护进程
async function selectDaemon() {
const _arr = ["开启-进程守护", "关闭-进程守护"];
uni.showActionSheet({
itemList: _arr,
success: async (res) => {
const _sel = _arr[res.tapIndex];
console.log('选中了第' + (res.tapIndex + 1) + '个按钮' + _sel);
if (res.tapIndex === 0) {
await daemonRun(true);
} else {
await daemonRun(false);
}
console.log("daemonRun", _sel, isDaemonRun.value);
},
fail: (res) => {
console.log(res.errMsg);
}
});
}
// 开启与关闭守护进程
async function daemonRun(run) {
// #ifdef APP-PLUS
if (run) {
Daemon_Uni.startWatchDog({
"api_name": "",
}, (ret) => {
console.log(ret);
isDaemonRun.value = true; // 假设总是成功开启
});
} else {
Daemon_Uni.closeWatchDog({
"api_name": "",
}, (ret) => {
console.log(ret);
// 同上,假设关闭总是成功
isDaemonRun.value = false;
});
}
// #endif
}
// 返回响应式数据和函数
return {
isDaemonRun,
selectDaemon,
daemonRun,
};
}

74
uniapp_project_code/src/pages/login/mixins/watchDogOptionsAPI.js

@ -0,0 +1,74 @@
// mixins/watchDog.js
// 离线人脸识别
// #ifdef APP-PLUS
const Daemon_Uni = uni.requireNativePlugin('Daemon_Uni');
// #endif
import util from '@/utils/util';
export default {
data() {
return {
is_daemon_run: false, //进程守护状态
}
},
created() {
console.warn('Mixin watchDog.js!');
},
methods: {
// 选择进程守护 开/关. 该函数为附带交互的进程守护开关选择
async selectDaemon(){
let that = this
let _arr = ["开启-进程守护","关闭-进程守护"];
uni.showActionSheet({
itemList:_arr,
success: async function (res) {
let _sel = _arr[res.tapIndex]
let _val = ""
console.log('选中了第' + (res.tapIndex + 1) + '个按钮' +_sel);
if(res.tapIndex==0){
let daemon_res = await that.daemonRun(true)
that.$nextTick(()=>{
// that.globalData.localConfig.is_daemon_run = daemon_res
that.is_daemon_run = daemon_res
});
}else{
let daemon_res = await that.daemonRun(false)
that.$nextTick(()=>{
// that.globalData.localConfig.is_daemon_run = daemon_res
that.is_daemon_run = daemon_res
});
}
console.log("daemonRun",_sel,_val,that.is_daemon_run)
},
fail: function (res) {
console.log(res.errMsg);
}
})
},
//开启与关闭保活
daemonRun(run){
// #ifdef APP-PLUS
if(run){
Daemon_Uni.startWatchDog({
"api_name":"",
},
(ret) => {
console.log(ret)
})
}else{
Daemon_Uni.closeWatchDog({
"api_name":"",
},
(ret) => {
console.log(ret)
})
}
// #endif
},
}
}

2
uniapp_project_code/src/utils/api.js

@ -1,4 +1,4 @@
export const ORIGIN = `http://ouxuanmaganer.ouxuanzhineng.cn`; // 正式
export const ORIGIN = `https://ouxuanmaganer.ouxuanzhineng.cn`; // 正式
// export const ORIGIN = `https://testmanager.ouxuanzhineng.cn`; // 测试

Loading…
Cancel
Save