Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnyq committed Sep 12, 2024
1 parent 89f09fc commit aba9796
Show file tree
Hide file tree
Showing 15 changed files with 878 additions and 524 deletions.
File renamed without changes.
17 changes: 6 additions & 11 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { ntnyq, pluginVue } from '@ntnyq/eslint-config'
import { ntnyq } from '@ntnyq/eslint-config'

export default ntnyq([
{
ignores: ['./src/index.html'],
},
{
plugins: {
vue: pluginVue,
},
rules: {
export default ntnyq({
ignores: ['./src/index.html'],
vue: {
overrides: {
'vue/prefer-true-attribute-shorthand': 'off',
'vue/component-name-in-template-casing': [
'error',
Expand All @@ -20,4 +15,4 @@ export default ntnyq([
],
},
},
])
})
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "taro-vue3-zhihudaily",
"version": "0.3.0",
"private": true,
"packageManager": "pnpm@9.9.0",
"packageManager": "pnpm@9.10.0",
"description": "taro-vue3-zhihudaily",
"templateInfo": {
"name": "vue3-NutUI",
Expand Down Expand Up @@ -36,12 +36,12 @@
"dayjs": "^1.11.13",
"pinia": "^2.2.2",
"taro-plugin-pinia": "^1.0.0",
"vue": "^3.5.3"
"vue": "^3.5.4"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@ntnyq/eslint-config": "^2.8.2",
"@ntnyq/eslint-config": "^3.0.0-beta.10",
"@ntnyq/prettier-config": "^1.21.2",
"@tarojs/cli": "^4.0.5",
"@tarojs/helper": "^4.0.5",
Expand All @@ -50,19 +50,19 @@
"@tarojs/shared": "^4.0.5",
"@tarojs/webpack5-runner": "^4.0.5",
"@types/webpack-env": "^1.18.5",
"@vue/babel-plugin-jsx": "^1.2.4",
"@vue/compiler-sfc": "^3.5.3",
"@vue/babel-plugin-jsx": "^1.2.5",
"@vue/compiler-sfc": "^3.5.4",
"babel-preset-taro": "^4.0.5",
"bumpp": "^9.5.2",
"eslint": "^9.10.0",
"husky": "^9.1.5",
"husky": "^9.1.6",
"nano-staged": "^0.8.0",
"pnpm": "^9.9.0",
"pnpm": "^9.10.0",
"postcss": "^8.4.45",
"prettier": "^3.3.3",
"taro-define-config": "^0.6.2",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^5.5.4",
"typescript": "^5.6.2",
"unplugin-vue-components": "^0.27.4",
"vue-loader": "^17.4.2",
"vue-tsc": "^2.1.6",
Expand Down
1,328 changes: 844 additions & 484 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import '@nutui/nutui-taro/dist/style.css'
import '@/app.scss'
import {
Avatar,
Button,
Expand All @@ -10,10 +10,10 @@ import {
Noticebar,
Toast,
} from '@nutui/nutui-taro'
import '@nutui/nutui-taro/dist/style.css'
import { useUserStore } from '@/stores/user'
import { createPinia } from 'pinia'
import { createApp } from 'vue'
import { useFavoriteStore } from '@/stores/favorite'
import '@/app.scss'
import { useUserStore } from '@/stores/user'

const App = createApp({
onShow() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/PosterBuilder/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Taro from '@tarojs/taro'
import { defineComponent, onMounted, ref } from 'vue'
import { drawBlock, drawImage, drawLine, drawText } from './utils/draw'
import { getImageInfo, getLinearColor, getRandomId, toPx, toRpx } from './utils/tools'
import type { DrawConfig, Image } from './types'
import type { PropType } from 'vue'
import type { DrawConfig, Image } from './types'
export default defineComponent({
name: 'PosterBuilder',
Expand Down
3 changes: 1 addition & 2 deletions src/components/PosterBuilder/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export const getImageInfo = (item, index) =>

/**
* 获取线性渐变色
* TODO: 待优化, 支持所有角度,多个颜色的线性渐变
* @param ctx canvas 实例对象
* @param color 线性渐变色,如 'linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 100%)'
* @param startX 起点 x 坐标
Expand All @@ -210,8 +211,6 @@ export const getImageInfo = (item, index) =>
* @param h 高度
* @returns grd
*/
// TODO: 待优化, 支持所有角度,多个颜色的线性渐变
// eslint-disable-next-line max-params
export function getLinearColor(ctx: CanvasContext, color, startX, startY, w, h) {
if (
typeof startX !== 'number' ||
Expand Down
2 changes: 1 addition & 1 deletion src/packages/user/author/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { Service } from '@nutui/icons-vue-taro'
import { ref } from 'vue'
const contributors = ref([
{
Expand Down
2 changes: 1 addition & 1 deletion src/packages/user/copy/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { ref } from 'vue'
import Taro from '@tarojs/taro'
import { ref } from 'vue'
const email = ref('[email protected]')
Expand Down
6 changes: 3 additions & 3 deletions src/pages/detail/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue'
import { Photograph, Share } from '@nutui/icons-vue-taro'
import {
authorize,
getSetting,
Expand All @@ -13,12 +13,12 @@ import {
useShareAppMessage,
useShareTimeline,
} from '@tarojs/taro'
import { Photograph, Share } from '@nutui/icons-vue-taro'
import { computed, onMounted, ref } from 'vue'
import PosterBuilder from '@/components/PosterBuilder/index.vue'
import { getNewsDetail } from '@/services'
import { useFavoriteStore } from '@/stores/favorite'
import { formatTime } from '@/utils'
import { normalizeStory } from '@/utils/translators'
import { useFavoriteStore } from '@/stores/favorite'
import type { DrawConfig } from '@/components/PosterBuilder/types'
import type { Question } from '@/types'
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index/index.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import Taro, { usePullDownRefresh, useReachBottom } from '@tarojs/taro'
import { formatTime } from '@/utils'
import { onMounted, ref } from 'vue'
import { getLatestNewsList, getNewsListByDate } from '@/services'
import { formatTime } from '@/utils'
import type { Story, TopStory } from '@/types'
const INIT_DATE_OFFSET = 0
Expand Down
2 changes: 1 addition & 1 deletion src/pages/user/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import Taro from '@tarojs/taro'
import { useUserStore } from '@/stores/user'
import { useFavoriteStore } from '@/stores/favorite'
import { useUserStore } from '@/stores/user'
import type { MpEvent } from '@tarojs/taro'
const userStore = useUserStore()
Expand Down
4 changes: 2 additions & 2 deletions src/stores/favorite.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { defineStore } from 'pinia'
import { StoreModule } from '@/types'
import * as Storage from '@/utils/storage'
import { StoreModole } from '@/types'
import type { StoryMeta } from '@/types'

export interface IFavoriteState {
list: StoryMeta[]
}

export const useFavoriteStore = defineStore(StoreModole.favorite, {
export const useFavoriteStore = defineStore(StoreModule.favorite, {
state: (): IFavoriteState => ({
list: [],
}),
Expand Down
4 changes: 2 additions & 2 deletions src/stores/user.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { defineStore } from 'pinia'
import { StoreModule } from '@/types'
import * as Storage from '@/utils/storage'
import { StoreModole } from '@/types'

export interface IUserState {
avatar: string
nickname: string
}

export const useUserStore = defineStore(StoreModole.user, {
export const useUserStore = defineStore(StoreModule.user, {
state: (): IUserState => ({
avatar: '',
nickname: '',
Expand Down
2 changes: 1 addition & 1 deletion src/types/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @file Store
*/

export enum StoreModole {
export enum StoreModule {
user = 'USER',
favorite = 'FAVORITE',
}

0 comments on commit aba9796

Please sign in to comment.