diff --git a/.env.development b/.env.development index 3158bf1..e17ded4 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://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/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/index.vue b/src/pages/inLocation/index.vue index 7b47048..363a689 100644 --- a/src/pages/inLocation/index.vue +++ b/src/pages/inLocation/index.vue @@ -47,6 +47,7 @@ getCurrentInstance } from 'vue' import * as inLocationApi from "@/api/inLocation.js" + import auth from '@/plugins/auth' const { proxy } = getCurrentInstance() const params = ref({ @@ -56,6 +57,7 @@ const status = ref('loadmore') //是否显示没有更多了 const list = ref([]) function openDetail(item){ + if(!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/index.vue b/src/pages/outLocation/index.vue index 97e1adf..ceab2ae 100644 --- a/src/pages/outLocation/index.vue +++ b/src/pages/outLocation/index.vue @@ -64,6 +64,7 @@ getCurrentInstance } from 'vue' import * as outLocationApi from "@/api/outLocation.js" + import auth from '@/plugins/auth' const { proxy } = getCurrentInstance() const params = ref({ pageNo: 1, @@ -73,6 +74,7 @@ const list = ref([]) function openDetail(item){ + if(!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/plugins/auth.js b/src/plugins/auth.js index 3b91c14..fb5665d 100644 --- a/src/plugins/auth.js +++ b/src/plugins/auth.js @@ -1,60 +1,64 @@ -import store from '@/store' +// import store from '@/store' +import { + useCountStore +} from '@/store' +const store = useCountStore() 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 = store && store.permissions + 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 = store && store.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..0d22a8f 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 @@ -63,8 +62,7 @@ const useStore = defineStore('storeId', { 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 = ''