|  | @@ -1,7 +1,7 @@
 | 
	
		
			
				|  |  | +import { useRouter } from '../core/utils/router'
 | 
	
		
			
				|  |  |  import { useUserStore } from '../store'
 | 
	
		
			
				|  |  |  import { storeToRefs } from 'pinia'
 | 
	
		
			
				|  |  |  import { computed } from 'vue'
 | 
	
		
			
				|  |  | -import { path } from 'node:path'
 | 
	
		
			
				|  |  |  export const usePermissions = () => {
 | 
	
		
			
				|  |  |    const userStore = useUserStore()
 | 
	
		
			
				|  |  |    const { isLogined, isDesigner, userInfo } = storeToRefs(userStore)
 | 
	
	
		
			
				|  | @@ -67,10 +67,39 @@ export const usePermissions = () => {
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 微信代运营兑换
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    // wechatAgentExchange: isLogined.value,
 | 
	
		
			
				|  |  | +    wechatAgentExchange: isLogined.value,
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 案例拍摄兑换
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | +    caseExchange: isLogined.value,
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 商城兑换
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    mallExchange: [isLogined.value, isDesigner.value],
 | 
	
		
			
				|  |  |    }))
 | 
	
		
			
				|  |  | -  return { isLogined, isDesigner, routes, features }
 | 
	
		
			
				|  |  | +  /**
 | 
	
		
			
				|  |  | +   * 按钮操作权限
 | 
	
		
			
				|  |  | +   */
 | 
	
		
			
				|  |  | +  const clickByPermission = (
 | 
	
		
			
				|  |  | +    name: 'wechatAgentExchange' | 'caseExchange' | 'mallExchange',
 | 
	
		
			
				|  |  | +    callback: () => void,
 | 
	
		
			
				|  |  | +  ) => {
 | 
	
		
			
				|  |  | +    const features = [
 | 
	
		
			
				|  |  | +      { name: 'mallExchange', meta: { canNotLogin: false, canNotDesigner: false } },
 | 
	
		
			
				|  |  | +      { name: 'wechatAgentExchange', meta: { canNotLogin: false, canNotDesigner: false } },
 | 
	
		
			
				|  |  | +    ]
 | 
	
		
			
				|  |  | +    const feature = features.find((item) => item.name === name)
 | 
	
		
			
				|  |  | +    if (feature) {
 | 
	
		
			
				|  |  | +      if (!feature.meta.canNotLogin && !isLogined.value) {
 | 
	
		
			
				|  |  | +        useRouter().push('/pages/login/index')
 | 
	
		
			
				|  |  | +        return
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      if (!feature.meta.canNotDesigner && !isDesigner.value) {
 | 
	
		
			
				|  |  | +        useRouter().push('/pages/mine/authentication/index')
 | 
	
		
			
				|  |  | +        return
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    callback()
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  return { isLogined, isDesigner, routes, features, clickByPermission }
 | 
	
		
			
				|  |  |  }
 |