oss.js 867 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const state = {
  2. region: 'oss-cn-beijing',
  3. accessKeyId: 'LTAI5tJe94eBRuNzuVFyt1C2',
  4. accessKeySecret: 'YRhe8lc7vpbxX8Fi4qvosDqVERFdjJ',
  5. bucket: 'yangguzhineng',
  6. folder: 'test',
  7. progress: 0,
  8. ossBaseUrl: '',
  9. stsToken: ''
  10. }
  11. const mutations = {
  12. SET_REGION: (state, payload) => {
  13. state.region = payload
  14. },
  15. SET_ACCESS_KEY_ID: (state, payload) => {
  16. state.accessKeyId = payload
  17. },
  18. SET_ACCESS_KEY_SECRET: (state, payload) => {
  19. state.accessKeySecret = payload
  20. },
  21. SET_BUCKET: (state, payload) => {
  22. state.bucket = payload
  23. },
  24. SET_FOLDER: (state, payload) => {
  25. state.folder = payload
  26. },
  27. SET_PROGRESS: (state, payload) => {
  28. state.progress = payload
  29. },
  30. SET_OSS_BASE_URL: (state) => {
  31. state.ossBaseUrl = `https://${state.bucket}.${state.region}.aliyuncs.com/`
  32. }
  33. }
  34. const actions = {}
  35. export default {
  36. namespaced: true,
  37. state,
  38. mutations,
  39. actions
  40. }