From 29febf427b5d8e89feafe3fad7f029aa2ae9451f Mon Sep 17 00:00:00 2001 From: Jason <5340635+wen-jason@user.noreply.gitee.com> Date: Fri, 9 Sep 2022 18:42:41 +0800 Subject: [PATCH] =?UTF-8?q?lint=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/api/shop.ts | 6 +- app/src/components/news-card/news-card.vue | 108 +-- app/src/components/tab/tab.vue | 146 ++-- app/src/components/tabs/tabs.vue | 780 +++++++++++---------- app/src/enums/agreementEnums.ts | 1 - app/src/enums/appEnums.ts | 10 +- app/src/enums/cacheEnums.ts | 2 +- app/src/hooks/useTouch.ts | 53 +- app/src/main.ts | 1 + app/src/pages/agreement/agreement.vue | 69 +- app/src/pages/as_us/as_us.vue | 40 +- app/src/pages/collection/collection.vue | 111 +-- app/src/pages/news/component/news-list.vue | 115 +-- app/src/pages/news/news.vue | 105 ++- app/src/pages/news_detail/news_detail.vue | 183 ++--- app/src/pages/search/component/suggest.vue | 123 ++-- app/src/pages/search/search.vue | 248 +++---- app/src/pages/user_data/user_data.vue | 700 +++++++++--------- app/src/pages/user_set/user_set.vue | 216 +++--- app/src/utils/util.ts | 2 +- 20 files changed, 1543 insertions(+), 1476 deletions(-) diff --git a/app/src/api/shop.ts b/app/src/api/shop.ts index 246444df..78208e54 100644 --- a/app/src/api/shop.ts +++ b/app/src/api/shop.ts @@ -12,7 +12,7 @@ export function getDecorate(data: any) { /** * @description 热门搜索 - * @return { Promise } + * @return { Promise } */ export function getHotSearch() { return request.get({ url: '/hotSearch' }) @@ -21,8 +21,8 @@ export function getHotSearch() { /** * @description 搜索 * @param { string } keyword 关键词 - * @return { Promise } + * @return { Promise } */ -export function getSearch(data: { keyword: string, pageNo: number, pageSize: number }) { +export function getSearch(data: { keyword: string; pageNo: number; pageSize: number }) { return request.get({ url: '/search', data }) } diff --git a/app/src/components/news-card/news-card.vue b/app/src/components/news-card/news-card.vue index 29c88202..0e332066 100644 --- a/app/src/components/news-card/news-card.vue +++ b/app/src/components/news-card/news-card.vue @@ -1,57 +1,65 @@ \ No newline at end of file +.news-card { + border-bottom: 1px solid #f8f8f8; + &-content { + &-title { + -webkit-line-clamp: 2; + overflow: hidden; + word-break: break-all; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + } + &-intro { + -webkit-line-clamp: 1; + overflow: hidden; + word-break: break-all; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + } + } +} + diff --git a/app/src/components/tab/tab.vue b/app/src/components/tab/tab.vue index 0d752bdc..4c7ae53c 100644 --- a/app/src/components/tab/tab.vue +++ b/app/src/components/tab/tab.vue @@ -1,79 +1,83 @@ - - + + - - diff --git a/app/src/components/tabs/tabs.vue b/app/src/components/tabs/tabs.vue index 8b5f1890..9a4c4ad9 100644 --- a/app/src/components/tabs/tabs.vue +++ b/app/src/components/tabs/tabs.vue @@ -1,71 +1,106 @@ - - - - - diff --git a/app/src/enums/agreementEnums.ts b/app/src/enums/agreementEnums.ts index a49c4f1c..7a717f45 100644 --- a/app/src/enums/agreementEnums.ts +++ b/app/src/enums/agreementEnums.ts @@ -3,4 +3,3 @@ export enum AgreementEnum { PRIVACY = 'privacy', SERVICE = 'service' } - diff --git a/app/src/enums/appEnums.ts b/app/src/enums/appEnums.ts index ad412d5a..c399d6ab 100644 --- a/app/src/enums/appEnums.ts +++ b/app/src/enums/appEnums.ts @@ -21,14 +21,14 @@ export enum SMSEnum { } export enum SearchTypeEnum { - HISTORY = 'history' + HISTORY = 'history' } // 用户资料 export enum FieldType { NONE = '', - AVATAR = 'avatar', - USERNAME = 'username', + AVATAR = 'avatar', + USERNAME = 'username', NICKNAME = 'nickname', - SEX = 'sex', -} \ No newline at end of file + SEX = 'sex' +} diff --git a/app/src/enums/cacheEnums.ts b/app/src/enums/cacheEnums.ts index 9cb6d9e0..6e22a14b 100644 --- a/app/src/enums/cacheEnums.ts +++ b/app/src/enums/cacheEnums.ts @@ -4,4 +4,4 @@ export const TOKEN_KEY = 'token' // 搜索历史记录 -export const HISTORY = 'history' \ No newline at end of file +export const HISTORY = 'history' diff --git a/app/src/hooks/useTouch.ts b/app/src/hooks/useTouch.ts index 509764a9..acd5bca1 100644 --- a/app/src/hooks/useTouch.ts +++ b/app/src/hooks/useTouch.ts @@ -1,13 +1,13 @@ -import { reactive } from "vue" +import { reactive } from 'vue' /** * @description 触碰屏幕钩子函数 * @return { Function } 暴露钩子 */ -export function useTouch () { +export function useTouch() { // 最小移动距离 - const MIN_DISTANCE = 10; - + const MIN_DISTANCE = 10 + const touch = reactive({ direction: '', deltaX: 0, @@ -22,48 +22,47 @@ export function useTouch () { */ const getDirection = (x: number, y: number) => { if (x > y && x > MIN_DISTANCE) { - return 'horizontal'; + return 'horizontal' } if (y > x && y > MIN_DISTANCE) { - return 'vertical'; + return 'vertical' } - return ''; + return '' } - + /** * @description 重置参数 */ const resetTouchStatus = () => { - touch.direction = ''; - touch.deltaX = 0; - touch.deltaY = 0; - touch.offsetX = 0; - touch.offsetY = 0; + touch.direction = '' + touch.deltaX = 0 + touch.deltaY = 0 + touch.offsetX = 0 + touch.offsetY = 0 } - + /** * @description 触发 */ const touchStart = (event: any) => { - resetTouchStatus(); - const events = event.touches[0]; - touch.startX = events.clientX; - touch.startY = events.clientY; + resetTouchStatus() + const events = event.touches[0] + touch.startX = events.clientX + touch.startY = events.clientY } - + /** * @description 移动 */ const touchMove = (event: any) => { - const events = event.touches[0]; - touch.deltaX = events.clientX - touch.startX; - touch.deltaY = events.clientY - touch.startY; - touch.offsetX = Math.abs(touch.deltaX); - touch.offsetY = Math.abs(touch.deltaY); - touch.direction = - touch.direction || getDirection(touch.offsetX, touch.offsetY); + const events = event.touches[0] + touch.deltaX = events.clientX - touch.startX + touch.deltaY = events.clientY - touch.startY + touch.offsetX = Math.abs(touch.deltaX) + touch.offsetY = Math.abs(touch.deltaY) + touch.direction = touch.direction || getDirection(touch.offsetX, touch.offsetY) } - + return { touch, resetTouchStatus, diff --git a/app/src/main.ts b/app/src/main.ts index 5351a99b..93da3003 100644 --- a/app/src/main.ts +++ b/app/src/main.ts @@ -5,6 +5,7 @@ import './router' import './styles/index.scss' export function createApp() { const app = createSSRApp(App) + app.use(plugins) return { app diff --git a/app/src/pages/agreement/agreement.vue b/app/src/pages/agreement/agreement.vue index 7a646e23..f0f6fab7 100644 --- a/app/src/pages/agreement/agreement.vue +++ b/app/src/pages/agreement/agreement.vue @@ -1,36 +1,35 @@ - - + + - - +import { reactive, ref } from 'vue' +import { onLoad } from '@dcloudio/uni-app' +import { AgreementEnum } from '@/enums/agreementEnums' +import { getPolicy } from '@/api/app' + +let agreementType = ref('') // 协议类型 +const agreementContent = ref('') // 协议内容 + +const getData = async (type) => { + const res = await getPolicy({ type }) + console.log(res, 'res') + + agreementContent.value = res.content + + uni.setNavigationBarTitle({ + title: res.name + }) +} + +onLoad((options: any) => { + if (options.type) { + agreementType = options.type + getData(agreementType) + } +}) + + + diff --git a/app/src/pages/as_us/as_us.vue b/app/src/pages/as_us/as_us.vue index 43f4988c..22ee329a 100644 --- a/app/src/pages/as_us/as_us.vue +++ b/app/src/pages/as_us/as_us.vue @@ -1,22 +1,22 @@ - - + + - - diff --git a/app/src/pages/collection/collection.vue b/app/src/pages/collection/collection.vue index c824c28a..a6c1c8f3 100644 --- a/app/src/pages/collection/collection.vue +++ b/app/src/pages/collection/collection.vue @@ -1,50 +1,61 @@ - - - - - + + + + + diff --git a/app/src/pages/news/component/news-list.vue b/app/src/pages/news/component/news-list.vue index 6175a21f..e09a92c0 100644 --- a/app/src/pages/news/component/news-list.vue +++ b/app/src/pages/news/component/news-list.vue @@ -1,50 +1,65 @@ - - - - - + + + + + diff --git a/app/src/pages/news/news.vue b/app/src/pages/news/news.vue index fb3b0c56..698d6c9c 100644 --- a/app/src/pages/news/news.vue +++ b/app/src/pages/news/news.vue @@ -1,63 +1,58 @@ - - - - const tabList = ref< any >([]) - const current = ref(0) - - const handleChange = (index: number) => { - console.log(index) - current.value = Number(index) - } - - const getData = async () => { - tabList.value = await getArticleCate() - } - - onLoad((options) => { - getData() - }) - - diff --git a/app/src/pages/news_detail/news_detail.vue b/app/src/pages/news_detail/news_detail.vue index 0ed5b231..265f536b 100644 --- a/app/src/pages/news_detail/news_detail.vue +++ b/app/src/pages/news_detail/news_detail.vue @@ -1,95 +1,96 @@ - - - - const newsData = ref< any >({}) - let newsId = '' - - - const getData = async (id) => { - newsData.value = await getArticleDetail({ id }) - } - - const handleAddCollect = async (articleId: number) => { - try{ - if( newsData.value.collect ) { - await cancelCollect({ articleId }) - } else await addCollect({ articleId }) - getData(newsId) - }catch(e){ - //TODO handle the exception - } - } - - onLoad((options: any) => { - newsId = options.id - getData(newsId) - }) - - diff --git a/app/src/pages/search/component/suggest.vue b/app/src/pages/search/component/suggest.vue index 32386223..cb808eb7 100644 --- a/app/src/pages/search/component/suggest.vue +++ b/app/src/pages/search/component/suggest.vue @@ -1,67 +1,70 @@ - - \ No newline at end of file +.suggest { + height: 100%; + .keyword { + display: inline-block; + margin: 24rpx 16rpx 0 0; + padding: 8rpx 24rpx; + border-radius: 26rpx; + background-color: #f4f4f4; + } +} + diff --git a/app/src/pages/search/search.vue b/app/src/pages/search/search.vue index ceac229c..b50878d5 100644 --- a/app/src/pages/search/search.vue +++ b/app/src/pages/search/search.vue @@ -1,127 +1,127 @@ - - - - diff --git a/app/src/pages/user_data/user_data.vue b/app/src/pages/user_data/user_data.vue index 88da3072..78717ff7 100644 --- a/app/src/pages/user_data/user_data.vue +++ b/app/src/pages/user_data/user_data.vue @@ -1,350 +1,350 @@ - - - - - + + + + + diff --git a/app/src/pages/user_set/user_set.vue b/app/src/pages/user_set/user_set.vue index 5a8a5920..29d9c498 100644 --- a/app/src/pages/user_set/user_set.vue +++ b/app/src/pages/user_set/user_set.vue @@ -1,108 +1,108 @@ - - - - - + + + + + diff --git a/app/src/utils/util.ts b/app/src/utils/util.ts index 155b8f60..1bfe679f 100644 --- a/app/src/utils/util.ts +++ b/app/src/utils/util.ts @@ -123,7 +123,7 @@ export function uploadFile(path: any) { success: (res) => { console.log('uploadFile res ==> ', res) const data = JSON.parse(res.data) - console.log('data.code', data.code) + console.log('data.code', data.code) if (data.code == 200) { resolve(data.data) } else {