Compare commits

..

No commits in common. "ce75f9b8f6bcd3a9029122e0c23fad8359b76b2a" and "7b8d89bb85cc00f6793d820b2b10d3d8ea749ce0" have entirely different histories.

4 changed files with 102 additions and 109 deletions

165
App.vue
View File

@ -1,31 +1,31 @@
<script>
// #ifdef APP-PLUS
import appUpdate from '@/components/appUpdate/appUpdate.js'
import appUpdate from "@/components/appUpdate/appUpdate.js";
// #endif
import { jwtDecode } from 'jwt-decode'
import { jwtDecode } from "jwt-decode";
export default {
onLaunch: function () {
console.log('%c%s', 'color:red', 'onLaunch---')
uni.showLoading({ title: '加载中' })
console.log("%c%s", "color:red", "onLaunch---");
uni.showLoading({ title: "加载中" });
// uni.setStorageSync("token", "");
window.initFn = this.initFn
window.initFn = this.initFn;
// this.initFn();
//console.log('App Launch')
// #ifdef APP-PLUS
let systemInfo = uni.getSystemInfoSync()
let systemInfo = uni.getSystemInfoSync();
const data = {
appid: systemInfo.appId,
version: systemInfo.appVersion
}
console.log(data)
version: systemInfo.appVersion,
};
console.log(data);
//appid
this.$api.checkVersion(data).then(res => {
console.log(res)
this.$api.checkVersion(data).then((res) => {
console.log(res);
if (res.code == 0) {
//0
appUpdate(res)
appUpdate(res);
}
})
});
// #endif
},
onShow: function () {
@ -36,36 +36,36 @@ export default {
updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) {
//
uni.showLoading({ title: '更新中...' }) // Loading
uni.showLoading({ title: "更新中..." }); // Loading
}
})
});
//
updateManager.onUpdateReady(function () {
uni.hideLoading() // Loading
uni.hideLoading(); // Loading
uni.showModal({
//
title: '更新提示',
content: '更新完毕,是否重启?',
title: "更新提示",
content: "更新完毕,是否重启?",
success: function (res) {
if (res.confirm) {
updateManager.applyUpdate() // 使
updateManager.applyUpdate(); // 使
}
}
})
})
},
});
});
//
updateManager.onUpdateFailed(function () {
uni.hideLoading() // Loading
uni.showToast({ title: '更新失败,稍后再试...', icon: 'error' })
})
uni.hideLoading(); // Loading
uni.showToast({ title: "更新失败,稍后再试...", icon: "error" });
});
// #endif
},
onHide: function () {},
onHide: function () { },
methods: {
initFn(data) {
uni.hideLoading() // Loading
uni.hideLoading(); // Loading
if (!data) {
return uni.showToast({ title: '未传入参数 initFn', icon: 'none' })
return uni.showToast({ title: "未传入参数 initFn", icon: "none" });
}
// uni.showModal({
// title: "initFn",
@ -74,85 +74,84 @@ export default {
// success: function (res) {},
// });
// "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiIwOGRkNzFiZC01N2MxLTQ1YmMtODBiYS0xMjkzYjU4MTViMmEiLCJ1bmlxdWVfbmFtZSI6IuS_nea0gSIsInJvbGUiOiJVc2VyIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbW9iaWxlcGhvbmUiOiIxODE3NDAxMDU2MiIsImdyb3Vwc2lkIjoiNGIyZDk2NjItYTc2OC0wOGYyLWEwYzgtNzYyYjhjNzZkYTJhIiwibmJmIjoxNzQ0MjYzMTAyLCJleHAiOjE3NDQyNjY3MDIsImlhdCI6MTc0NDI2MzEwMn0.ZJTwC7rWCcywoM7ncysw-JRIiwXz4y_6hlmqctN-gMM"
let token = data.token
uni.setStorageSync('token', 'Bearer ' + token)
console.log(jwtDecode(token), '解析的token信息')
let resData = jwtDecode(token)
this.$u.vuex('vuex_userData', resData)
console.log(this.vuex_userData, 'vuex_userData')
let token = data.token;
uni.setStorageSync("token", "Bearer " + token);
console.log(jwtDecode(token), "解析的token信息");
let resData = jwtDecode(token);
this.$u.vuex("vuex_userData", resData);
// User | Admin
let role = resData.role
console.log(role, 'role----')
let role = resData.role;
console.log(role, "role----");
// return;
if (role === 'User') {
if (role === "User") {
const normalTabBar = [
{
pagePath: '/pages/index/planList',
iconPath: '/static/tab/planList.png',
selectedIconPath: '/static/tab/planList-active.png',
text: '计划'
pagePath: "/pages/index/planList",
iconPath: "/static/tab/planList.png",
selectedIconPath: "/static/tab/planList-active.png",
text: "计划",
},
{
pagePath: '/pages/index/index',
iconPath: '/static/tab/admin-home.png',
selectedIconPath: '/static/tab/admin-home-acitve.png',
text: '首页'
pagePath: "/pages/index/index",
iconPath: "/static/tab/admin-home.png",
selectedIconPath: "/static/tab/admin-home-acitve.png",
text: "首页",
},
{
pagePath: '/pages/user/index',
iconPath: '/static/tab/admin-my.png',
selectedIconPath: '/static/tab/admin-my-active.png',
text: '设置'
}
]
this.$u.vuex('vuex_tabbar', normalTabBar)
pagePath: "/pages/user/index",
iconPath: "/static/tab/admin-my.png",
selectedIconPath: "/static/tab/admin-my-active.png",
text: "设置",
},
];
this.$u.vuex("vuex_tabbar", normalTabBar);
uni.switchTab({
url: '/pages/index/index',
url: "/pages/index/index",
success() {
console.log('跳转成功')
window.initFn = null //
console.log("跳转成功");
window.initFn = null; //
},
fail(err) {
console.error('跳转失败', err)
}
})
console.error("跳转失败", err);
},
});
} else {
const adminTabBar = [
{
pagePath: '/pages/adminHome/index',
iconPath: '/static/tab/admin-home.png',
selectedIconPath: '/static/tab/admin-home-acitve.png',
text: '首页'
pagePath: "/pages/adminHome/index",
iconPath: "/static/tab/admin-home.png",
selectedIconPath: "/static/tab/admin-home-acitve.png",
text: "首页",
},
{
pagePath: '/pages/adminNfc/index',
iconPath: '/static/tab/nfc.png',
selectedIconPath: '/static/tab/nfc-active.png',
text: 'nfc写入'
pagePath: "/pages/adminNfc/index",
iconPath: "/static/tab/nfc.png",
selectedIconPath: "/static/tab/nfc-active.png",
text: "nfc写入",
},
{
pagePath: '/pages/adminMy/index',
iconPath: '/static/tab/admin-my.png',
selectedIconPath: '/static/tab/admin-my-active.png',
text: '我的'
}
]
this.$u.vuex('vuex_tabbar', adminTabBar)
pagePath: "/pages/adminMy/index",
iconPath: "/static/tab/admin-my.png",
selectedIconPath: "/static/tab/admin-my-active.png",
text: "我的",
},
];
this.$u.vuex("vuex_tabbar", adminTabBar);
uni.switchTab({
url: '/pages/adminHome/index',
url: "/pages/adminHome/index",
success() {
console.log('跳转成功')
window.initFn = null //
console.log("跳转成功");
window.initFn = null; //
},
fail(err) {
console.error('跳转失败', err)
}
})
console.error("跳转失败", err);
},
});
}
}
}
}
},
},
};
</script>
<style lang="scss">
@import '@/uni_modules/uview-ui/index.scss';
@import "@/uni_modules/uview-ui/index.scss";
</style>

View File

@ -82,10 +82,6 @@ export default {
onLoad() {},
methods: {
async nfcInitFn(data) {
if(this.vuex_userData.nfcwrite !== 'True'){
uni.showToast({ title: '暂无NFC卡写入权限', icon: 'none' })
return
}
if (!data) {
uni.showToast({ title: '未传入参数nfcInitFn', icon: 'none' })
return

View File

@ -12,10 +12,12 @@
</view>
</view>
<!-- tabs -->
<u-tabs class="tabs-box" bg-color="#F6F8FC" :list="tabsList" :is-scroll="true" :current="tabCurrent" @change="tabChangeFn"></u-tabs>
<u-tabs class="tabs-box" bg-color="#F6F8FC" :list="tabsList" :is-scroll="true" :current="tabCurrent"
@change="tabChangeFn"></u-tabs>
<!-- 搜索 -->
<view class="search-box">
<u-input class="search-input" v-model="keyword" :clearable="false" border placeholder="搜索名称" @keyup.enter="searchFn"></u-input>
<u-input class="search-input" v-model="keyword" :clearable="false" border placeholder="搜索名称"
@keyup.enter="searchFn"></u-input>
<u-icon name="search" class="search-icon" size="40" @click="searchFn"></u-icon>
<view class="select-box" @click="selectFn">
<view>
@ -43,7 +45,8 @@
<!-- 筛选的下拉 -->
<u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet>
<!-- 弹窗 -->
<bind-dialog ref="dialogRef" :visible="showDialog" @close="showDialog = false" :currentRow="currentRow" @changeBinding="onChangeBinding" @confirm="onConfirm" @closeRes="closeResFn"></bind-dialog>
<bind-dialog ref="dialogRef" :visible="showDialog" @close="showDialog = false" :currentRow="currentRow"
@changeBinding="onChangeBinding" @confirm="onConfirm" @closeRes="closeResFn"></bind-dialog>
<u-tabbar :list="vuex_tabbar"></u-tabbar>
</view>
@ -111,37 +114,35 @@ export default {
},
methods: {
dialogShowFn(row) {
// console.log(this.vuex_userData.nfcwrite)
// return
//
let u = navigator.userAgent
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1 //android
let u = navigator.userAgent;
let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
console.log(row.state, 'row.state--')
//
if (row.state === false) {
try {
if (isAndroid && AndroidJs) {
console.log('%c%s', 'color:red', '安卓--调用方法')
console.log("%c%s", "color:red", "安卓--调用方法");
const reqRow = {
name: 'area',
name: "area",
data: {
// state: row.state,
state: true,
areaId: row.id
}
}
areaId: row.id,
},
};
console.log(reqRow, 'reqRow--')
AndroidJs.func(JSON.stringify(reqRow)) //
AndroidJs.func(JSON.stringify(reqRow)); //
} else {
console.log('%c%s', 'color:red', '苹果--调用方法')
console.log("%c%s", "color:red", "苹果--调用方法");
const reqRow = {
name: 'back-iphone',
data: ''
}
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)) // ios
name: "back-iphone",
data: "",
};
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)); // ios
}
} catch (e) {
console.log(e, 'e-----判断安卓苹果类型出错')
console.log(e, "e-----判断安卓苹果类型出错");
}
}

View File

@ -77,9 +77,6 @@ export default {
let token = res.data
uni.setStorageSync('token', 'Bearer ' + token)
console.log(jwtDecode(token), '解析的token信息')
let resData = jwtDecode(token)
this.$u.vuex('vuex_userData', resData)
console.log(this.vuex_userData, 'vuex_userData')
// return
console.log(type, 'type--')
if (type === 'user') {