diff --git a/.env.development b/.env.development index 3158bf1..dd2d32d 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -VITE_BASE_URL=http://192.168.0.106:12080/admin-api +VITE_BASE_URL=http://localhost:12080/admin-api #VITE_BASE_URL=http://dev.ccwin-in.com:25203/api/admin-api -VITE_BASE_URL_IMAGE=http://localhost:12080/admin-api \ No newline at end of file +VITE_BASE_URL_IMAGE=http://192.168.0.106:12080/admin-api \ No newline at end of file diff --git a/.env.production b/.env.production index 7e42eab..2b60e3b 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,2 @@ -VITE_BASE_URL=http://10.62.139.32:82/api/admin-api -VITE_BASE_URL_IMAGE=http://10.62.139.32:82/api/admin-api +VITE_BASE_URL=http://dev.ccwin-in.com:25210/admin-api +VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25210/admin-api diff --git a/aliasPassword.txt b/aliasPassword.txt new file mode 100644 index 0000000..22147f9 --- /dev/null +++ b/aliasPassword.txt @@ -0,0 +1,8 @@ +证书名称:pdatest.keystore +证书别名:pdatestalias +证书密码:092134 +SHA1: 53:30:B7:A6:0B:10:FA:0A:5A:3A:2F:4A:E5:21:96:EC:79:5B:41:C1 + SHA256: C4:85:45:66:D5:FC:6E:FB:C8:45:5D:FA:41:8D:94:6D:E5:C1:41:CE:D0:E3:4D:B3:F9:3B:68:6A:1B:E2:43:86 +Android 包名:com.eampda.uniapp +Android 应用签名:aa65e187685c2088b82d1a8c143bbabe//还没弄 +ios 包名:com.eam.bundleld//还没弄 \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index f9a5113..8688fed 100644 --- a/nginx.conf +++ b/nginx.conf @@ -27,7 +27,7 @@ http { gzip_vary on; gzip_disable "MSIE [1-6]\."; upstream eam { - server localhost:90 weight=10 max_fails=3 fail_timeout=10s; + server localhost:25210 weight=10 max_fails=3 fail_timeout=10s; } server { listen 25203; diff --git a/pdatest.keystore b/pdatest.keystore new file mode 100644 index 0000000..e2133f2 Binary files /dev/null and b/pdatest.keystore differ diff --git a/src/App.vue b/src/App.vue index 01203cc..6ec90eb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -51,8 +51,38 @@ }) } // #endif + // plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) { + // _this.$post('common/upApp', { + // version: widgetInfo.version, + // }).then(res => { + // if (res.status == 0) { + // if (res.data.code == 0) { + // uni.downloadFile({ + // url: res.data.download, + // success: (downloadResult) => { + // if (downloadResult.statusCode === 200) { + // plus.runtime.install(downloadResult + // .tempFilePath, { + // force: true + // }, + // function() { + // plus.runtime.restart(); + // }, + // function(e) { + + + // }); + // } + // } + // }); + // } + // } + // }) + // }); if (getAccessToken()) { await store.GetPermissionInfo().then(res => { + uni.setStorageSync('permissionInfo',res.permissions) + uni.setStorageSync('roles',res.roles) }).catch(() => { }) await store.GetInfo().then(res => { }).catch(() => { }) diff --git a/src/api/inLocation.js b/src/api/inLocation.ts similarity index 100% rename from src/api/inLocation.js rename to src/api/inLocation.ts diff --git a/src/api/location.js b/src/api/location.ts similarity index 100% rename from src/api/location.js rename to src/api/location.ts diff --git a/src/api/login.js b/src/api/login.ts similarity index 100% rename from src/api/login.js rename to src/api/login.ts diff --git a/src/api/outLocation.js b/src/api/outLocation.ts similarity index 100% rename from src/api/outLocation.js rename to src/api/outLocation.ts diff --git a/src/api/spareParts.js b/src/api/spareParts.ts similarity index 100% rename from src/api/spareParts.js rename to src/api/spareParts.ts diff --git a/src/api/sparePartsReturn.js b/src/api/sparePartsReturn.ts similarity index 100% rename from src/api/sparePartsReturn.js rename to src/api/sparePartsReturn.ts diff --git a/src/api/upload.js b/src/api/upload.ts similarity index 100% rename from src/api/upload.js rename to src/api/upload.ts diff --git a/src/api/user.js b/src/api/user.ts similarity index 100% rename from src/api/user.js rename to src/api/user.ts diff --git a/src/main.ts b/src/main.ts index c19c964..d5de468 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,6 +9,7 @@ import App from './App.vue' import tab from './plugins/tab' import modal from './plugins/modal' import time from './plugins/time' +import auth from './plugins/auth' // unocss @@ -30,6 +31,7 @@ export function createApp() { app.config.globalProperties.$modal = modal // 时间对象 app.config.globalProperties.$time = time + app.config.globalProperties.$auth = auth diff --git a/src/manifest.json b/src/manifest.json index 4000fae..4d15faa 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { "name" : "富维汽车镜", - "appid" : "__UNI__DA78BC9", + "appid" : "__UNI__0DC0349", "description" : "", "versionName" : "1.0.0", "versionCode" : "100", @@ -16,6 +16,9 @@ "autoclose" : true, "delay" : 0 }, + "compatible" : { + "ignoreVersion" : true + }, /* 模块配置 */ "modules" : {}, /* 应用发布信息 */ diff --git a/src/pages/inLocation/addForm.vue b/src/pages/inLocation/addForm.vue index 93c999a..946c6c5 100644 --- a/src/pages/inLocation/addForm.vue +++ b/src/pages/inLocation/addForm.vue @@ -133,9 +133,9 @@ ref, getCurrentInstance } from 'vue' - import * as inLocationApi from "@/api/inLocation.js" - import * as sparePartsApi from "@/api/spareParts.js" - import * as locationApi from "@/api/location.js" + import * as inLocationApi from "@/api/inLocation" + import * as sparePartsApi from "@/api/spareParts" + import * as locationApi from "@/api/location" const { proxy } = getCurrentInstance() const loading = ref(false) diff --git a/src/pages/inLocation/index.vue b/src/pages/inLocation/index.vue index 7b47048..d6d50c7 100644 --- a/src/pages/inLocation/index.vue +++ b/src/pages/inLocation/index.vue @@ -46,7 +46,7 @@ ref, getCurrentInstance } from 'vue' - import * as inLocationApi from "@/api/inLocation.js" + import * as inLocationApi from "@/api/inLocation" const { proxy } = getCurrentInstance() const params = ref({ @@ -56,6 +56,7 @@ const status = ref('loadmore') //是否显示没有更多了 const list = ref([]) function openDetail(item){ + if(!proxy.$auth.hasPermiOr(['eam:item-order-main:inOperation']))return; proxy.$tab.navigateTo(`/pages/inLocation/addForm?data=${encodeURIComponent(JSON.stringify(item))}`) } async function getList() { diff --git a/src/pages/index.vue b/src/pages/index.vue index a43f79f..82e4759 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -34,7 +34,28 @@ - + + {{item.name}} + + + + + + + + + + + + {{cur.name}} + + + + + + + + + 退出登录 @@ -102,14 +123,14 @@ // 获取自定义的store const store = useCountStore() const bgOpacity = ref(0) - const menus1 = ref([]) - const menus2 = ref([]) + const meaus = ref([]) + // const menus2 = ref([]) function open(url) { if (!getAccessToken()) { proxy.$tab.navigateTo('/pages/login') return } - proxy.$tab.navigateTo(url) + proxy.$tab.navigateTo("/" + url) } function handleLogout() { proxy.$modal.confirm('确定注销并退出系统吗?').then(() => { @@ -123,8 +144,10 @@ } onLoad(async () => { await proxy.$onLaunched; - menus1.value = store.menus1 - menus2.value = store.menus2 + // menus1.value = store.menus1 + // menus2.value = store.menus2 + meaus.value = store.meaus + console.log(meaus.value ) }) onPageScroll((e) => { if (e.scrollTop > 0) { diff --git a/src/pages/login.vue b/src/pages/login.vue index 18faabd..9a7929d 100644 --- a/src/pages/login.vue +++ b/src/pages/login.vue @@ -63,6 +63,18 @@ // 获取自定义的store const store = useCountStore() + if( import.meta.env.VITE_USER_NODE_ENV == 'development'){ + loginForm.value = { + tenantName: "闻荫源码", + username: "admin", + password: "123456", + captchaVerification: "", + rememberMe: false, + code: '1', + uuid: "APP", + cid:uni.getStorageSync('cid') + } + } async function handleLogin(params) { if (loginForm.value.username === "") { proxy.$modal.msgError("请输入您的账号") diff --git a/src/pages/outLocation/addForm.vue b/src/pages/outLocation/addForm.vue index 87e128f..275c84d 100644 --- a/src/pages/outLocation/addForm.vue +++ b/src/pages/outLocation/addForm.vue @@ -151,8 +151,8 @@ ref, getCurrentInstance } from 'vue' - import * as outLocationApi from "@/api/outLocation.js" - import * as locationApi from "@/api/location.js" + import * as outLocationApi from "@/api/outLocation" + import * as locationApi from "@/api/location" const { proxy } = getCurrentInstance() const loading = ref(false) diff --git a/src/pages/outLocation/index.vue b/src/pages/outLocation/index.vue index 97e1adf..dc37c0c 100644 --- a/src/pages/outLocation/index.vue +++ b/src/pages/outLocation/index.vue @@ -63,7 +63,8 @@ ref, getCurrentInstance } from 'vue' - import * as outLocationApi from "@/api/outLocation.js" + import * as outLocationApi from "@/api/outLocation" + import auth from '@/plugins/auth' const { proxy } = getCurrentInstance() const params = ref({ pageNo: 1, @@ -73,6 +74,7 @@ const list = ref([]) function openDetail(item){ + if(!proxy.$auth.hasPermiOr(['eam:item-apply-record-main:outOperation']))return; proxy.$tab.navigateTo(`/pages/outLocation/addForm?data=${encodeURIComponent(JSON.stringify(item))}`) } async function getList() { diff --git a/src/pages/scanCode/scanCode.vue b/src/pages/scanCode/scanCode.vue index ac5608b..161b672 100644 --- a/src/pages/scanCode/scanCode.vue +++ b/src/pages/scanCode/scanCode.vue @@ -70,7 +70,7 @@ ref, getCurrentInstance } from 'vue' - import * as locationApi from "@/api/location.js" + import * as locationApi from "@/api/location" const { proxy } = getCurrentInstance() const number = ref('LN0000000001') const list = ref([]) diff --git a/src/pages/sparePartsReturn/addForm.vue b/src/pages/sparePartsReturn/addForm.vue index d8cb531..efc4040 100644 --- a/src/pages/sparePartsReturn/addForm.vue +++ b/src/pages/sparePartsReturn/addForm.vue @@ -100,10 +100,10 @@ ref, getCurrentInstance } from 'vue' - import * as userApi from "@/api/user.js" - import * as sparePartsReturnApi from "@/api/sparePartsReturn.js" - import * as sparePartsApi from "@/api/spareParts.js" - import * as locationApi from "@/api/location.js" + import * as userApi from "@/api/user" + import * as sparePartsReturnApi from "@/api/sparePartsReturn" + import * as sparePartsApi from "@/api/spareParts" + import * as locationApi from "@/api/location" const { proxy } = getCurrentInstance() const loading = ref(false) diff --git a/src/plugins/auth.js b/src/plugins/auth.js index 3b91c14..4f0663b 100644 --- a/src/plugins/auth.js +++ b/src/plugins/auth.js @@ -1,60 +1,60 @@ -import store from '@/store' + function authPermission(permission) { - const all_permission = "*:*:*" - const permissions = store.getters && store.getters.permissions - if (permission && permission.length > 0) { - return permissions.some(v => { - return all_permission === v || v === permission - }) - } else { - return false - } + const all_permission = "*:*:*" + const permissions =uni.getStorageSync('permissionInfo') + if (permission && permission.length > 0) { + return permissions.some(v => { + return all_permission === v || v === permission + }) + } else { + return false + } } function authRole(role) { - const super_admin = "admin" - const roles = store.getters && store.getters.roles - if (role && role.length > 0) { - return roles.some(v => { - return super_admin === v || v === role - }) - } else { - return false - } + const super_admin = "admin" + const roles = uni.getStorageSync('roles') + if (role && role.length > 0) { + return roles.some(v => { + return super_admin === v || v === role + }) + } else { + return false + } } export default { - // 验证用户是否具备某权限 - hasPermi(permission) { - return authPermission(permission) - }, - // 验证用户是否含有指定权限,只需包含其中一个 - hasPermiOr(permissions) { - return permissions.some(item => { - return authPermission(item) - }) - }, - // 验证用户是否含有指定权限,必须全部拥有 - hasPermiAnd(permissions) { - return permissions.every(item => { - return authPermission(item) - }) - }, - // 验证用户是否具备某角色 - hasRole(role) { - return authRole(role) - }, - // 验证用户是否含有指定角色,只需包含其中一个 - hasRoleOr(roles) { - return roles.some(item => { - return authRole(item) - }) - }, - // 验证用户是否含有指定角色,必须全部拥有 - hasRoleAnd(roles) { - return roles.every(item => { - return authRole(item) - }) - } -} + // 验证用户是否具备某权限 + hasPermi(permission) { + return authPermission(permission) + }, + // 验证用户是否含有指定权限,只需包含其中一个 + hasPermiOr(permissions) { + return permissions.some(item => { + return authPermission(item) + }) + }, + // 验证用户是否含有指定权限,必须全部拥有 + hasPermiAnd(permissions) { + return permissions.every(item => { + return authPermission(item) + }) + }, + // 验证用户是否具备某角色 + hasRole(role) { + return authRole(role) + }, + // 验证用户是否含有指定角色,只需包含其中一个 + hasRoleOr(roles) { + return roles.some(item => { + return authRole(item) + }) + }, + // 验证用户是否含有指定角色,必须全部拥有 + hasRoleAnd(roles) { + return roles.every(item => { + return authRole(item) + }) + } +} \ No newline at end of file diff --git a/src/store/modules/countStore.ts b/src/store/modules/countStore.ts index d152f09..c1b77b8 100644 --- a/src/store/modules/countStore.ts +++ b/src/store/modules/countStore.ts @@ -20,8 +20,7 @@ const useStore = defineStore('storeId', { role: '', post: '', dept: '', - menus1: [], - menus2: [], + meaus: [], }), getters: { // isEven: (state) => state.count % 2 === 0 @@ -57,14 +56,16 @@ const useStore = defineStore('storeId', { this.roles = res.roles this.role = res.roles.filter(item => item == 'all_approve' || item == 'normal_approve')[0] this.permissions = res.permissions + + uni.setStorageSync('permissionInfo',res.permissions) + uni.setStorageSync('roles',res.roles) let menus = [] res.menus.forEach(item => { if (item.path == '/pda') { menus = item.children } }) - this.menus1 = menus.filter(item => item.path !== 'itemOut') - this.menus2 = menus.filter(item => item.path === 'itemOut') + this.meaus = menus } else { this.roles = [] this.role = '' @@ -109,6 +110,8 @@ const useStore = defineStore('storeId', { this.post = '' this.dept = '' removeToken() + uni.removeStorageSync('permissionInfo') + uni.removeStorageSync('roles') resolve(res) }).catch(error => { reject(error)