diff --git a/.eslintrc.js b/.eslintrc.js index 8a6684bf..0851496a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,7 @@ module.exports = { extends: ['plugin:vue/vue3-essential', 'prettier'], rules: { - 'vue/no-unused-vars': 'error' + 'vue/no-unused-vars': 'error', + semi: 'off' } }; diff --git a/package.json b/package.json index a9c8e949..c0cce6b5 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "dependencies": { "@element-plus/icons": "^0.0.11", "@types/chrome": "^0.0.157", + "@types/humps": "^2.0.1", "axios": "^0.21.1", "dayjs": "^1.10.7", "diff-match-patch": "^1.0.5", @@ -16,6 +17,7 @@ "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-vue": "^7.17.0", + "humps": "^2.0.1", "husky": "^7.0.2", "prettier": "^2.3.2", "qrcode.vue": "3.3.0", diff --git a/src/components/content/Publication.vue b/src/components/content/Publication.vue new file mode 100644 index 00000000..5f301699 --- /dev/null +++ b/src/components/content/Publication.vue @@ -0,0 +1,128 @@ + + + + + diff --git a/src/components/content/index.ts b/src/components/content/index.ts new file mode 100644 index 00000000..43aae66b --- /dev/null +++ b/src/components/content/index.ts @@ -0,0 +1,2 @@ +import Publication from './Publication.vue'; +export { Publication }; diff --git a/src/i18n/zh/index.ts b/src/i18n/zh/index.ts index cd4deef9..4779f049 100644 --- a/src/i18n/zh/index.ts +++ b/src/i18n/zh/index.ts @@ -2,10 +2,12 @@ import common from './common/index'; import content from './content/index'; import platform from './platform/index'; import auth from './auth/index'; +import publication from './publication'; export default { common, content, platform, - auth + auth, + publication }; diff --git a/src/i18n/zh/publication/index.ts b/src/i18n/zh/publication/index.ts new file mode 100644 index 00000000..bc2163d4 --- /dev/null +++ b/src/i18n/zh/publication/index.ts @@ -0,0 +1,5 @@ +import state from './state'; + +export default { + state +}; diff --git a/src/i18n/zh/publication/state.ts b/src/i18n/zh/publication/state.ts new file mode 100644 index 00000000..f78d8235 --- /dev/null +++ b/src/i18n/zh/publication/state.ts @@ -0,0 +1,5 @@ +export default { + pending: '等待发布', + running: '发布中', + finished: '发布成功' +}; diff --git a/src/main.ts b/src/main.ts index 2790bf85..a545b67d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,7 +7,6 @@ import i18n from './i18n/index'; import './assets/css/tailwind.css'; import './assets/scss/style.scss'; import dayjs from './plugins/dayjs'; - const app = createApp(App); app.use(router); @@ -17,4 +16,5 @@ app.use(i18n); app.use(dayjs, { formatString: 'YYYY-MM-DD HH:mm:ss' }); +// app.mixin(constants); app.mount('#app'); diff --git a/src/mixins/constants.ts b/src/mixins/constants.ts new file mode 100644 index 00000000..ff4afd52 --- /dev/null +++ b/src/mixins/constants.ts @@ -0,0 +1,22 @@ +import { + PUBLICATION_STATE_PENDING, + PUBLICATION_STATE_FINISHED, + PUBLICATION_STATE_RUNNING +} from '@/services/content/publication/constants'; + +interface IData { + PUBLICATION_STATE_PENDING: string; + PUBLICATION_STATE_RUNNING: string; + PUBLICATION_STATE_FINISHED: string; +} + +export default { + name: 'Constants', + data(): IData { + return { + PUBLICATION_STATE_PENDING: PUBLICATION_STATE_PENDING, + PUBLICATION_STATE_RUNNING: PUBLICATION_STATE_RUNNING, + PUBLICATION_STATE_FINISHED: PUBLICATION_STATE_FINISHED + }; + } +}; diff --git a/src/mixins/index.ts b/src/mixins/index.ts new file mode 100644 index 00000000..c13c83d2 --- /dev/null +++ b/src/mixins/index.ts @@ -0,0 +1,4 @@ +import Constants from './constants'; +import Methods from './methods'; + +export { Constants, Methods }; diff --git a/src/mixins/methods.ts b/src/mixins/methods.ts new file mode 100644 index 00000000..f2832007 --- /dev/null +++ b/src/mixins/methods.ts @@ -0,0 +1,14 @@ +interface IData { + isEqual: (a: any, b: any) => boolean; +} + +export default { + name: 'Methods', + data(): IData { + return { + isEqual(a: any, b: any): boolean { + return a === b; + } + }; + } +}; diff --git a/src/pages/auth/Login.vue b/src/pages/auth/Login.vue index 747aa504..d5794c75 100644 --- a/src/pages/auth/Login.vue +++ b/src/pages/auth/Login.vue @@ -68,15 +68,15 @@ export default defineComponent({ .then( async ({ data: { - access_token, - refresh_token, + accessToken, + refreshToken, user: { id } } }: { data: IWechatLoginStatusResponse; }) => { - await this.$store.dispatch('setRefreshToken', refresh_token); - await this.$store.dispatch('setAccessToken', access_token); + await this.$store.dispatch('setRefreshToken', refreshToken); + await this.$store.dispatch('setAccessToken', accessToken); this.getUserInfo(id); } ) diff --git a/src/pages/content/article/Detail.vue b/src/pages/content/article/Detail.vue index b79419e7..ae66693d 100644 --- a/src/pages/content/article/Detail.vue +++ b/src/pages/content/article/Detail.vue @@ -6,6 +6,12 @@
+ + {{ $t('common.button.publish') }} + + + + @@ -13,6 +19,7 @@