diff --git a/src/store/getters.js b/src/store/getters.js index 0d97c03..e57fc29 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -7,6 +7,7 @@ const getters = { token: state => state.user.token, avatar: state => state.user.avatar, name: state => state.user.name, + userId: state => state.user.userId, introduction: state => state.user.introduction, roles: state => state.user.roles, permissions: state => state.user.permissions, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 9617236..b2e266c 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -7,10 +7,14 @@ const user = { name: '', avatar: '', roles: [], - permissions: [] + permissions: [], + userId: null, }, mutations: { + SET_USERID: (state, userId) => { + state.userId = userId + }, SET_TOKEN: (state, token) => { state.token = token }, @@ -59,6 +63,7 @@ const user = { commit('SET_ROLES', ['ROLE_DEFAULT']) } commit('SET_NAME', user.userName) + commit('SET_USERID', user.userId) commit('SET_AVATAR', avatar) resolve(res) }).catch(error => { diff --git a/src/utils/is-star-plugin.js b/src/utils/is-star-plugin.js index 5048a9a..32d4b2c 100644 --- a/src/utils/is-star-plugin.js +++ b/src/utils/is-star-plugin.js @@ -20,6 +20,7 @@ const allowDisparity = 1000 * 60 * 60 * 24 * 7 */ export function isStarRepo(owner, repo, userId, redirectUrl,productName,productLink) { const key = userId + '_' + owner + '_' + repo + console.log(key) // 判断是否近期已经判断过了 try { if (typeof window !== 'undefined') { diff --git a/src/views/oms/order/index.vue b/src/views/oms/order/index.vue index 1846cab..cd531fd 100644 --- a/src/views/oms/order/index.vue +++ b/src/views/oms/order/index.vue @@ -264,8 +264,12 @@ import { import AddressSelector from "@/views/components/AddressSelector/index.vue"; import dateUtil, {dateFormat} from '@/utils/DateUtil'; import {isStarRepo} from "@/utils/is-star-plugin" +import {mapGetters} from "vuex"; export default { + computed:{ + ...mapGetters(['userId']), + }, name: "OmsOrder", dicts: ["oms_order_status", "oms_pay_type"], components: { diff --git a/src/views/pms/product/index.vue b/src/views/pms/product/index.vue index 32fe54d..ffb6815 100644 --- a/src/views/pms/product/index.vue +++ b/src/views/pms/product/index.vue @@ -121,6 +121,7 @@