diff --git a/common/appInit.js b/common/appInit.js
index 42f42d1273f3788f118bd68dc6db87a5f6b367b9..7b5c233889bbb512ae5c036b50827f737106a8af 100644
--- a/common/appInit.js
+++ b/common/appInit.js
@@ -90,7 +90,13 @@ export default function() {
});
}
}
- })
+ })
+
+// #ifdef APP-PLUS
+// 设备网络状态变化事件
+ eventListenerNetwork()
+// #endif
+
}
/**
* // 初始化appVersion
@@ -126,31 +132,52 @@ function initAppVersion() {
// 设备网络状态变化事件
function eventListenerNetwork() {
- uni.onNetworkStatusChange(function(res) {
- console.log(res.isConnected);
- console.log(res.networkType);
- if (!res.isConnected) {
- uni.showModal({
- content: "你未打开网络连接",
- confirmText: "前往打开",
- complete: (e) => {
- console.log(e);
- if (uni.getSystemInfoSync().platform == "ios") {
- plus.runtime.launchApplication({
- action: 'App-Prefs:root=WIFI'
- }, function(e) {
- console.log(JSON.stringify(e));
- });
- } else {
- var main = plus.android.runtimeMainActivity();
- var Intent = plus.android.importClass("android.content.Intent");
- var mIntent = new Intent('android.settings.DATA_ROAMING_SETTINGS');
- main.startActivity(mIntent);
- }
- }
- });
- }
- });
+ //网络掉线
+ uni.getNetworkType({
+ success:res=>{
+ console.log(res);
+ if(res.networkType=='none'){
+ showNetworkErrPage()
+ }
+ uni.showToast({
+ title:'当前网络类型:'+res.networkType,
+ icon:'none',
+ duration:3000
+ })
+ }
+ });
+ //监听网络变化
+ uni.onNetworkStatusChange(res=> {
+ console.log(res.isConnected);
+ console.log(res.networkType);
+ if(res.networkType!='none'){
+ uni.showToast({
+ title:'当前网络类型:'+res.networkType,
+ icon:'none',
+ duration:3000
+ })
+ }else{
+ showNetworkErrPage()
+ uni.showToast({
+ title:'网络类型:'+res.networkType,
+ icon:'none',
+ duration:3000
+ })
+ }
+ });
+
+ function showNetworkErrPage(){
+ let pages = getCurrentPages();
+ console.log('pages.length',pages.length);
+ if(pages.length===0|| pages[pages.length - 1].route!='/pages/networkErr/networkErr.vue'){
+ uni.navigateTo({
+ url:'/pages/networkErr/networkErr'
+ })
+ }else{
+ console.log('已经打开');
+ }
+ }
+
}
function openAppPermissionSetting(){
diff --git a/pages.json b/pages.json
index 0bd55de0def075ece08b8bd030203de7ba839c2f..873dddd363689710d2a8a098916c17b38d753187 100644
--- a/pages.json
+++ b/pages.json
@@ -5,22 +5,21 @@
//#ifndef MP
"navigationStyle": "custom",
//#endif
- "enablePullDownRefresh": true,
- "app-plus":{
- "subNVues":[
- {
- "id":"networkErr",
- "path":"pages/list/networkErr/networkErr",
- "style":{
- "height":"0",
- "width":"100%",
- "background":"transparent"
- }
- }
- ]
- }
+ "enablePullDownRefresh": true
}
- },
+ },
+ {
+ "path": "pages/networkErr/networkErr",
+ "style": {
+ "navigationStyle": "custom",
+ "backgroundColor": "transparent",
+ "app-plus": {
+ "animationType": "fade-in",
+ "background": "transparent",
+ "popGesture": "none"
+ }
+ }
+ },
{
"path": "pages/list/news-list",
"style": {
@@ -219,8 +218,7 @@
"backgroundColor": "#F8F8F8"
},
"condition": {
- "list": [
- {
+ "list": [{
"path": "pages/list/list"
},
{
@@ -234,7 +232,7 @@
}
],
"current": 0
-},
+ },
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#007AFF",
@@ -257,4 +255,4 @@
"text": "我的"
}]
}
-}
+}
diff --git a/pages/list/list.vue b/pages/list/list.vue
index 3039f908f70d12980e65543bc378bfbb4b6d1bbe..16794e08f174bb16b30ecb162037d72488b46425 100644
--- a/pages/list/list.vue
+++ b/pages/list/list.vue
@@ -20,7 +20,6 @@
},
onLoad() {
checkIsAgree();
- uni.getSubNVueById('networkErr').show()
},
onShow(options) {
this.searchText = getApp().globalData.searchText;
diff --git a/pages/list/networkErr/networkErr.nvue b/pages/networkErr/networkErr.vue
similarity index 52%
rename from pages/list/networkErr/networkErr.nvue
rename to pages/networkErr/networkErr.vue
index 559ff98b4f016b93691d11dd4294f7ade2a66024..6c594f52bd018a6a7f8932af36d253a43b14c879 100644
--- a/pages/list/networkErr/networkErr.nvue
+++ b/pages/networkErr/networkErr.vue
@@ -1,7 +1,9 @@
-
- 网络连接不可用
- 去设置
+
+
+ 网络连接不可用
+
+
@@ -13,42 +15,17 @@
}
},
mounted() {
- this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
- const getCurrentSubNVue = uni.getCurrentSubNVue();
- getCurrentSubNVue.setStyle({
- "height":this.statusBarHeight+60+'px'
- })
- uni.getNetworkType({
- success:res=>{
- console.log(res);
- if(res.networkType!='none'){
- getCurrentSubNVue.hide()
- }else{
- getCurrentSubNVue.show()
- }
- }
- });
uni.onNetworkStatusChange(res=> {
console.log(res.isConnected);
console.log(res.networkType);
-
-
if(res.networkType!='none'){
uni.showToast({
title:'当前网络类型:'+res.networkType,
icon:'none',
duration:3000
})
- if(this.old=='none'){
- this.$parent.reLink();
- }
- getCurrentSubNVue.hide()
- }else{
- getCurrentSubNVue.show()
- uni.showToast({
- title:'网络类型:'+res.networkType,
- icon:'none',
- duration:3000
+ uni.navigateBack({
+ animationType:'fade-out'
})
}
});
@@ -72,10 +49,20 @@
}
-
diff --git a/uniCloud-aliyun/database/uni-id-scores.schema.json b/uniCloud-aliyun/database/uni-id-scores.schema.json
index 69577c85397124a0b1df14bce6f1b82ecffebd47..7d5715acec10f6fb77de27c2616832d3e806d159 100644
--- a/uniCloud-aliyun/database/uni-id-scores.schema.json
+++ b/uniCloud-aliyun/database/uni-id-scores.schema.json
@@ -1,6 +1,9 @@
{
"bsonType": "object",
- "required": ["user_id", "score", "balance"],
+ "required": ["user_id", "score", "balance"],
+ "permission":{
+ "read":true
+ },
"properties": {
"_id": {
"description": "ID,系统自动生成"
diff --git a/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue b/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue
index 7f1eced06f74880838557eaf162f6cc295d9a3ac..f5d744a79f4f21aae60c1bd9a9345191b7d23d8a 100644
--- a/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue
+++ b/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue
@@ -370,7 +370,7 @@ $list-item-pd: $uni-spacing-col-lg $uni-spacing-row-lg;
/* #endif */
height: $uni-img-size-base;
width: $uni-img-size-base;
- marin-right: 10px;
+ margin-right: 10px;
}
.uni-icon-wrapper {