liuchen864 7 months ago
parent
commit
522b885a40
  1. 4
      .env.development
  2. 4
      .env.production
  3. 8
      aliasPassword.txt
  4. 2
      nginx.conf
  5. BIN
      pdatest.keystore
  6. 30
      src/App.vue
  7. 0
      src/api/inLocation.ts
  8. 0
      src/api/location.ts
  9. 0
      src/api/login.ts
  10. 0
      src/api/outLocation.ts
  11. 0
      src/api/spareParts.ts
  12. 0
      src/api/sparePartsReturn.ts
  13. 0
      src/api/upload.ts
  14. 0
      src/api/user.ts
  15. 2
      src/main.ts
  16. 5
      src/manifest.json
  17. 6
      src/pages/inLocation/addForm.vue
  18. 3
      src/pages/inLocation/index.vue
  19. 41
      src/pages/index.vue
  20. 12
      src/pages/login.vue
  21. 4
      src/pages/outLocation/addForm.vue
  22. 4
      src/pages/outLocation/index.vue
  23. 2
      src/pages/scanCode/scanCode.vue
  24. 8
      src/pages/sparePartsReturn/addForm.vue
  25. 104
      src/plugins/auth.js
  26. 11
      src/store/modules/countStore.ts

4
.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
VITE_BASE_URL_IMAGE=http://192.168.0.106:12080/admin-api

4
.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

8
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//还没弄

2
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;

BIN
pdatest.keystore

Binary file not shown.

30
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(() => { })

0
src/api/inLocation.js → src/api/inLocation.ts

0
src/api/location.js → src/api/location.ts

0
src/api/login.js → src/api/login.ts

0
src/api/outLocation.js → src/api/outLocation.ts

0
src/api/spareParts.js → src/api/spareParts.ts

0
src/api/sparePartsReturn.js → src/api/sparePartsReturn.ts

0
src/api/upload.js → src/api/upload.ts

0
src/api/user.js → src/api/user.ts

2
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

5
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" : {},
/* */

6
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)

3
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() {

41
src/pages/index.vue

@ -34,7 +34,28 @@
</view>
</view>
<view class="box">
<view class="">
<view class="" v-for="(item,index) in meaus" :key='index'>
<view class="title">{{item.name}}</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<u-col span="3" v-for="(cur,key) in item.children" :key='key'>
<view class="icon-item" @click="open(cur.path)">
<!-- 扫码图标 -->
<image src="../static/images/icon8.png" mode="" v-if="cur.componentName == 'scanCodeMeau'"></image>
<!-- 采购入库图标 -->
<image src="../static/images/icon1.png" mode="" v-else-if="cur.componentName == 'inLocation'"></image>
<!-- 备件归还图标 -->
<image src="../static/images/icon3.png" mode="" v-else-if="cur.componentName == 'sparePartsReturn'"></image>
<!-- 采购出库图标 -->
<image src="../static/images/icon2.png" mode="" v-else-if="cur.componentName == 'outLocation'"></image>
<view>{{cur.name}}</view>
</view>
</u-col>
</u-row>
</view>
<!-- <view class="">
<view class="title">扫码</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<u-col span="3">
@ -44,8 +65,8 @@
</view>
</u-col>
</u-row>
</view>
<view class="" v-if="menus1&&menus1.length>0">
</view> -->
<!-- <view class="" v-if="menus1&&menus1.length>0">
<view class="title">采购入库</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<block v-for="(item,index) in menus1" :key="index">
@ -77,7 +98,7 @@
</u-col>
</block>
</u-row>
</view>
</view> -->
</view>
<view class="btn" @click="handleLogout" v-if="getAccessToken()">退出登录</view>
</view>
@ -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) {

12
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("请输入您的账号")

4
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)

4
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() {

2
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([])

8
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)

104
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)
})
}
}

11
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)

Loading…
Cancel
Save