mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-07-27 12:30:41 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d71022c224 | |||
| d521a641de | |||
| 4246d8cdcb | |||
| 6989fd8ddc | |||
| 742b51a23e | |||
| bc541a3ef6 | |||
| 67fc682164 | |||
| b43dd7e5a7 | |||
| e29ccf65c5 | |||
| 91553fc053 | |||
| 22f57b7860 | |||
| 2a25727c0b | |||
| eb69ae4af6 | |||
| 2fd83a7814 | |||
| 8963ba1921 | |||
| 051c72b584 |
@@ -2,8 +2,3 @@ node_modules/
|
|||||||
unpackage/
|
unpackage/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
config/halo.config.js
|
|
||||||
config/love.config.js
|
|
||||||
config/token.config.js
|
|
||||||
config/plugins.config.js
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import HaloTokenConfig from '@/config/token.config.js';
|
import HaloTokenConfig from '@/config/uhalo.config.js';
|
||||||
|
|
||||||
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
|
// app升级检测(搭配:https://ext.dcloud.net.cn/plugin?id=4470 升级中心)
|
||||||
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
||||||
|
|||||||
+17
-17
@@ -1,13 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* 所有的接口
|
* 所有的接口
|
||||||
*/
|
*/
|
||||||
import HaloTokenConfig from '@/config/token.config.js'
|
import {getPersonalToken} from '@/utils/token.js'
|
||||||
import HttpHandler from '@/common/http/request.js'
|
import HttpHandler from '@/common/http/request.js'
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
|
|
||||||
import {
|
import {getAppConfigs} from '@/config/index.js'
|
||||||
getAppConfigs
|
|
||||||
} from '@/config/index.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +33,8 @@ export default {
|
|||||||
* @param {Object} params 数据
|
* @param {Object} params 数据
|
||||||
*/
|
*/
|
||||||
getPostListByKeyword: (params) => {
|
getPostListByKeyword: (params) => {
|
||||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/indices/post`, params)
|
// return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/indices/post`, params)
|
||||||
|
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/indices/-/search`, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,14 +42,14 @@ export default {
|
|||||||
* @param {Object} params 查询参数
|
* @param {Object} params 查询参数
|
||||||
*/
|
*/
|
||||||
getCategoryList: (params) => {
|
getCategoryList: (params) => {
|
||||||
const param = qs.stringify(params, {
|
const param = qs.stringify(params, {
|
||||||
allowDots: true,
|
allowDots: true,
|
||||||
encodeValuesOnly: true,
|
encodeValuesOnly: true,
|
||||||
skipNulls: true,
|
skipNulls: true,
|
||||||
encode: false,
|
encode: false,
|
||||||
arrayFormat: 'repeat'
|
arrayFormat: 'repeat'
|
||||||
})
|
})
|
||||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories?${param}`,{})
|
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories?${param}`, {})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 查询分类下的文章
|
* 查询分类下的文章
|
||||||
@@ -111,7 +110,7 @@ export default {
|
|||||||
getMomentList: (params) => {
|
getMomentList: (params) => {
|
||||||
return HttpHandler.Get(`/apis/moment.halo.run/v1alpha1/moments`, params, {
|
return HttpHandler.Get(`/apis/moment.halo.run/v1alpha1/moments`, params, {
|
||||||
custom: {
|
custom: {
|
||||||
systemToken: HaloTokenConfig.systemToken
|
personalToken: getPersonalToken()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -130,7 +129,7 @@ export default {
|
|||||||
getPhotoGroupList: (params) => {
|
getPhotoGroupList: (params) => {
|
||||||
return HttpHandler.Get(`/apis/core.halo.run/v1alpha1/photogroups`, params, {
|
return HttpHandler.Get(`/apis/core.halo.run/v1alpha1/photogroups`, params, {
|
||||||
custom: {
|
custom: {
|
||||||
systemToken: HaloTokenConfig.systemToken
|
personalToken: getPersonalToken()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -142,7 +141,7 @@ export default {
|
|||||||
getPhotoListByGroupName: (params) => {
|
getPhotoListByGroupName: (params) => {
|
||||||
return HttpHandler.Get(`/apis/console.api.photo.halo.run/v1alpha1/photos`, params, {
|
return HttpHandler.Get(`/apis/console.api.photo.halo.run/v1alpha1/photos`, params, {
|
||||||
custom: {
|
custom: {
|
||||||
systemToken: HaloTokenConfig.systemToken
|
personalToken: getPersonalToken()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -153,7 +152,7 @@ export default {
|
|||||||
getFriendLinkGroupList: (params) => {
|
getFriendLinkGroupList: (params) => {
|
||||||
return HttpHandler.Get(`/apis/core.halo.run/v1alpha1/linkgroups`, params, {
|
return HttpHandler.Get(`/apis/core.halo.run/v1alpha1/linkgroups`, params, {
|
||||||
custom: {
|
custom: {
|
||||||
systemToken: HaloTokenConfig.systemToken
|
personalToken: getPersonalToken()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -194,6 +193,7 @@ export default {
|
|||||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/restrict-read/create`, null, {
|
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/restrict-read/create`, null, {
|
||||||
header: {
|
header: {
|
||||||
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
||||||
|
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
* 修改时间:
|
* 修改时间:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import HaloTokenConfig from '@/config/token.config.js'
|
import HaloTokenConfig from '@/config/uhalo.config.js'
|
||||||
import {
|
import {
|
||||||
setInterceptors
|
setInterceptors
|
||||||
} from "./interceptors.js";
|
} from "./interceptors.js";
|
||||||
|
|||||||
+119
-135
@@ -9,149 +9,133 @@
|
|||||||
* 修改人员:
|
* 修改人员:
|
||||||
* 修改时间:
|
* 修改时间:
|
||||||
*/
|
*/
|
||||||
import {
|
import {delCache, setCache} from "@/utils/storage";
|
||||||
getAdminAccessToken
|
|
||||||
} from "@/utils/auth.js";
|
|
||||||
import {
|
|
||||||
delCache,
|
|
||||||
setCache
|
|
||||||
} from "@/utils/storage";
|
|
||||||
|
|
||||||
const getCategoryNameByUrl = (url) => {
|
const getCategoryNameByUrl = (url) => {
|
||||||
const reg = '(?<=/api/content/categories/).+(?=/posts)'
|
const reg = '(?<=/api/content/categories/).+(?=/posts)'
|
||||||
return url.match(reg)[0] || '无分类名'
|
return url.match(reg)[0] || '无分类名'
|
||||||
}
|
}
|
||||||
const showCategoryInputPasswordModal = (response, category) => {
|
const showCategoryInputPasswordModal = (response, category) => {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: `[ ${category} ] 分类已加密`, // TODO 这里应该获取分类的名字,可以在弹窗之前请求后台拿到所有分类根据分类code拿到名称,但是不会在这之前发送请求
|
title: `[ ${category} ] 分类已加密`, // TODO 这里应该获取分类的名字,可以在弹窗之前请求后台拿到所有分类根据分类code拿到名称,但是不会在这之前发送请求
|
||||||
content: '',
|
content: '',
|
||||||
editable: true,
|
editable: true,
|
||||||
placeholderText: '请输入分类密码后访问',
|
placeholderText: '请输入分类密码后访问',
|
||||||
confirmText: '验证密码',
|
confirmText: '验证密码',
|
||||||
cancelText: '暂不访问',
|
cancelText: '暂不访问',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
cancelColor: '#999999',
|
cancelColor: '#999999',
|
||||||
confirmColor: '#03a9f4',
|
confirmColor: '#03a9f4',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// TODO 这里如果没有输入密码点击确认应该阻止窗口关闭,但是没找到方法
|
// TODO 这里如果没有输入密码点击确认应该阻止窗口关闭,但是没找到方法
|
||||||
if (!res.content) {
|
if (!res.content) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提示:请输入密码',
|
title: '提示:请输入密码', icon: 'none', success: () => {
|
||||||
icon: 'none',
|
setTimeout(() => {
|
||||||
success: () => {
|
showCategoryInputPasswordModal(response, category);
|
||||||
setTimeout(() => {
|
}, 800)
|
||||||
showCategoryInputPasswordModal(response, category);
|
}
|
||||||
}, 800)
|
})
|
||||||
}
|
return;
|
||||||
})
|
}
|
||||||
return;
|
// 根据请求URL正则匹配分类code,然后把输入的密码根据分类code放入缓存,然后在category.getCategoryPostList中获取,解决多个分类加密输入密码后点错的问题
|
||||||
}
|
// 目前存在一个问题,比如前两个都需要密码,如果先输入第二个的密码之后,重新进来默认打开第一个还会弹窗,所以想在弹窗标题上增加分类名字
|
||||||
// 根据请求URL正则匹配分类code,然后把输入的密码根据分类code放入缓存,然后在category.getCategoryPostList中获取,解决多个分类加密输入密码后点错的问题
|
// 另外有以下两种方式科技解决
|
||||||
// 目前存在一个问题,比如前两个都需要密码,如果先输入第二个的密码之后,重新进来默认打开第一个还会弹窗,所以想在弹窗标题上增加分类名字
|
// TODO 1.其实这里获取到密码之后可以直接发送一个请求追加上password参数,因为后台会缓存权限,后续不输入密码也可以访问,可惜不会
|
||||||
// 另外有以下两种方式科技解决
|
// TODO 2.另外也可以拿到密码之后,直接选中该分类追加password参数,重新请求,可惜也不会
|
||||||
// TODO 1.其实这里获取到密码之后可以直接发送一个请求追加上password参数,因为后台会缓存权限,后续不输入密码也可以访问,可惜不会
|
setCache('APP_CATEGORY_PWD_' + category, res.content)
|
||||||
// TODO 2.另外也可以拿到密码之后,直接选中该分类追加password参数,重新请求,可惜也不会
|
uni.reLaunch({
|
||||||
setCache('APP_CATEGORY_PWD_' + category, res.content)
|
url: '/pages/tabbar/category/category'
|
||||||
uni.reLaunch({
|
});
|
||||||
url: '/pages/tabbar/category/category'
|
} else if (res.cancel) {
|
||||||
});
|
}
|
||||||
} else if (res.cancel) {}
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setInterceptors = (http) => {
|
export const setInterceptors = (http) => {
|
||||||
http.interceptors.request.use(
|
http.interceptors.request.use((config) => {
|
||||||
(config) => {
|
console.log("config", config)
|
||||||
console.log("config", config)
|
|
||||||
|
|
||||||
// 可使用async await 做异步操作
|
// 可使用async await 做异步操作
|
||||||
config.header = {
|
config.header = {
|
||||||
...config.header
|
...config.header
|
||||||
// ... 可以直接加参数
|
// ... 可以直接加参数
|
||||||
};
|
};
|
||||||
if (config.custom.systemToken) {
|
if (config.custom.personalToken) {
|
||||||
config.header['Authorization'] = `Bearer ${config.custom.systemToken}`
|
config.header['Authorization'] = `Bearer ${config.custom.personalToken}`
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
}, (config) => {
|
||||||
(config) => {
|
// 可使用async await 做异步操作
|
||||||
// 可使用async await 做异步操作
|
return Promise.reject(config);
|
||||||
return Promise.reject(config);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
http.interceptors.response.use(
|
http.interceptors.response.use((response) => {
|
||||||
(response) => {
|
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
||||||
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
|
||||||
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
|
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
|
||||||
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
|
// if (response.config.custom.verification) { // 演示自定义参数的作用
|
||||||
// if (response.config.custom.verification) { // 演示自定义参数的作用
|
// return response.data
|
||||||
// return response.data
|
// }
|
||||||
// }
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
return response.data;
|
return response.data;
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(response);
|
return Promise.reject(response);
|
||||||
}
|
}
|
||||||
},
|
}, (response) => {
|
||||||
(response) => {
|
/* 对响应错误做点什么 (statusCode !== 200)*/
|
||||||
/* 对响应错误做点什么 (statusCode !== 200)*/
|
if (!response.data) {
|
||||||
if (!response.data) {
|
return Promise.reject({
|
||||||
return Promise.reject({
|
status: 500, message: 'API接口服务异常!'
|
||||||
status: 500,
|
})
|
||||||
message: 'API接口服务异常!'
|
} else if (response.data.status == 401) {
|
||||||
})
|
uni.$tm.toast(response.data.message);
|
||||||
} else if (response.data.status == 401) {
|
// 如果是请求分类之后报401说明密码错误,那么清除该密码,下次点击会报403弹窗再次输入密码
|
||||||
uni.$tm.toast(response.data.message);
|
if (response.config.url.indexOf('/api/content/categories') >= 0) {
|
||||||
// 如果是请求分类之后报401说明密码错误,那么清除该密码,下次点击会报403弹窗再次输入密码
|
const category = getCategoryNameByUrl(response.config.url)
|
||||||
if (response.config.url.indexOf('/api/content/categories') >= 0) {
|
delCache('APP_CATEGORY_PWD_' + category);
|
||||||
const category = getCategoryNameByUrl(response.config.url)
|
uni.showToast({
|
||||||
delCache('APP_CATEGORY_PWD_' + category);
|
title: '提示:密码不正确', icon: 'none', success: () => {
|
||||||
uni.showToast({
|
setTimeout(() => {
|
||||||
title: '提示:密码不正确',
|
showCategoryInputPasswordModal(response, category);
|
||||||
icon: 'none',
|
}, 800)
|
||||||
success: () => {
|
}
|
||||||
setTimeout(() => {
|
})
|
||||||
showCategoryInputPasswordModal(response, category);
|
} else {
|
||||||
}, 800)
|
// 其他情况维持原来的逻辑
|
||||||
}
|
delCache('APP_ADMIN_LOGIN_TOKEN');
|
||||||
})
|
uni.$eShowModal({
|
||||||
} else {
|
title: '提示',
|
||||||
// 其他情况维持原来的逻辑
|
content: '您未登录超管账号或登录已过期,是否重新登录?',
|
||||||
delCache('APP_ADMIN_LOGIN_TOKEN');
|
showCancel: true,
|
||||||
uni.$eShowModal({
|
cancelText: '否',
|
||||||
title: '提示',
|
cancelColor: '#999999',
|
||||||
content: '您未登录超管账号或登录已过期,是否重新登录?',
|
confirmText: '是',
|
||||||
showCancel: true,
|
confirmColor: '#03a9f4'
|
||||||
cancelText: '否',
|
}).then(res => {
|
||||||
cancelColor: '#999999',
|
uni.navigateTo({
|
||||||
confirmText: '是',
|
url: '/pagesB/login/login'
|
||||||
confirmColor: '#03a9f4'
|
})
|
||||||
}).then(res => {
|
}).catch(err => {
|
||||||
uni.navigateTo({
|
uni.switchTab({
|
||||||
url: '/pagesB/login/login'
|
url: '/pages/tabbar/about/about'
|
||||||
})
|
})
|
||||||
}).catch(err => {
|
})
|
||||||
uni.switchTab({
|
}
|
||||||
url: '/pages/tabbar/about/about'
|
return Promise.reject(response.data);
|
||||||
})
|
} else if (response.data.status == 403) {
|
||||||
})
|
// 如果报403是请求分类文章接口(您没有该分类的访问权限)的话说明是私密分类,需要输入密码请求
|
||||||
}
|
if (response.config.url.indexOf('/api/content/categories') >= 0) {
|
||||||
return Promise.reject(response.data);
|
const category = getCategoryNameByUrl(response.config.url);
|
||||||
} else if (response.data.status == 403) {
|
showCategoryInputPasswordModal(response, category);
|
||||||
// 如果报403是请求分类文章接口(您没有该分类的访问权限)的话说明是私密分类,需要输入密码请求
|
}
|
||||||
if (response.config.url.indexOf('/api/content/categories') >= 0) {
|
return Promise.reject(response.data);
|
||||||
const category = getCategoryNameByUrl(response.config.url);
|
} else {
|
||||||
showCategoryInputPasswordModal(response, category);
|
return Promise.reject(response.data);
|
||||||
}
|
}
|
||||||
return Promise.reject(response.data);
|
|
||||||
} else {
|
|
||||||
return Promise.reject(response.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
});
|
||||||
);
|
};
|
||||||
};
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {getAppConfigs} from '@/config/index.js'
|
import {getAppConfigs} from '@/config/index.js'
|
||||||
import HaloTokenConfig from '@/config/token.config.js'
|
import HaloTokenConfig from '@/config/uhalo.config.js'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0 24rpx;
|
margin: 0 24rpx;
|
||||||
padding: 24rpx;
|
padding:22rpx 24rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #ffff;
|
background-color: #ffff;
|
||||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
|
|||||||
@@ -1,220 +1,222 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="article-min-card" :class="[globalAppSettings.layout.cardType]" @click="fnClickEvent('card')">
|
<view class="article-min-card" @click="fnClickEvent('card')">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.thumbnail)" :fileMd5="$utils.checkThumbnailUrl(article.thumbnail)" mode="aspectFill"></cache-image>
|
<cache-image class="thumbnail" radius="6rpx" :url="$utils.checkThumbnailUrl(article.spec.cover)" :fileMd5="article.spec.cover"
|
||||||
</view>
|
mode="aspectFill"></cache-image>
|
||||||
<view class="right">
|
</view>
|
||||||
<view class="title text-overflow">{{ article.title }}</view>
|
<view class="right">
|
||||||
<view class="content text-overflow">{{ article.summary }}</view>
|
<view class="title text-overflow">{{ article.spec.title }}</view>
|
||||||
<view class="foot">
|
<view class="content text-overflow">{{ article.status.excerpt }}</view>
|
||||||
<view class="create-time">
|
<view class="foot">
|
||||||
<!-- <text class="icon iconfont icon-clock"></text> -->
|
<view class="create-time">
|
||||||
<text class="time-label">发布时间:</text>
|
<text class="time-label">发布时间:</text>
|
||||||
{{ { d: article.createTime, f: 'yyyy-MM-dd' } | formatTime }}
|
{{ {d: article.spec.publishTime, f: 'yyyy-MM-dd'} | formatTime }}
|
||||||
</view>
|
</view>
|
||||||
<view class="visits">
|
<view class="visits">
|
||||||
<!-- <text class="icon iconfont icon-eye"></text> -->
|
浏览
|
||||||
浏览
|
<text class="number">{{ article.stats.visit }}</text>
|
||||||
<text class="number">{{ article.visits }}</text>
|
次
|
||||||
次
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'article-min-card',
|
name: 'article-min-card',
|
||||||
props: {
|
props: {
|
||||||
article: {
|
article: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
},
|
||||||
fnClickEvent() {
|
methods: {
|
||||||
this.$emit('on-click', this.article);
|
fnClickEvent() {
|
||||||
}
|
this.$emit('on-click', this.article);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.article-min-card {
|
.article-min-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #ffff;
|
background-color: #ffff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 12rpx 24rpx;
|
margin: 12rpx 24rpx;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
padding: 16rpx;
|
padding: 16rpx;
|
||||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
|
|
||||||
&.lr_image_text {}
|
&.lr_image_text {
|
||||||
|
}
|
||||||
|
|
||||||
&.lr_text_image {
|
&.lr_text_image {
|
||||||
.left {
|
.left {
|
||||||
order: 2;
|
order: 2;
|
||||||
padding-left: 30rpx;
|
padding-left: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
order: 1;
|
order: 1;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tb_image_text {
|
&.tb_image_text {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 220rpx;
|
height: 220rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin-top: 24rpx;
|
margin-top: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.foot {
|
.foot {
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
.create-time {
|
.create-time {
|
||||||
.time-label {
|
.time-label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.visits {
|
.visits {
|
||||||
margin-left: 24rpx;
|
margin-left: 24rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tb_text_image {
|
&.tb_text_image {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 220rpx;
|
height: 220rpx;
|
||||||
order: 2;
|
order: 2;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
order: 1;
|
order: 1;
|
||||||
|
|
||||||
.foot {
|
.foot {
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
.create-time {
|
.create-time {
|
||||||
.time-label {
|
.time-label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.visits {
|
.visits {
|
||||||
margin-left: 24rpx;
|
margin-left: 24rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.only_text {
|
&.only_text {
|
||||||
.left {
|
.left {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
|
||||||
.foot {
|
.foot {
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
.create-time {
|
.create-time {
|
||||||
.time-label {
|
.time-label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.visits {
|
.visits {
|
||||||
margin-left: 24rpx;
|
margin-left: 24rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
width: 180rpx;
|
width: 180rpx;
|
||||||
height: 130rpx;
|
height: 130rpx;
|
||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
width: 0;
|
width: 0;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding-left: 20rpx;
|
padding-left: 20rpx;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
margin-top: 14rpx;
|
margin-top: 14rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.foot {
|
.foot {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
margin-top: 14rpx;
|
margin-top: 14rpx;
|
||||||
|
|
||||||
.create-time {
|
.create-time {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
|
|
||||||
.time-label {
|
.time-label {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
padding-right: 4rpx;
|
padding-right: 4rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.visits {
|
.visits {
|
||||||
.icon {
|
.icon {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.number {
|
.number {
|
||||||
padding: 0 6rpx;
|
padding: 0 6rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.25);
|
||||||
backdrop-filter: blur(3rpx);
|
backdrop-filter: blur(3rpx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right-hot-ttf">
|
<view class="right-hot-ttf">
|
||||||
<text class="text hot-text">{{ title }}</text>
|
<text class="text hot-text text-overflow-2">{{ title }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 标题 -->
|
<!-- 标题 -->
|
||||||
<view class="Top-Title">
|
<view class="Top-Title">
|
||||||
<text class="text title-text">{{ item.title }}</text>
|
<text class="text title-text text-overflow-2">{{ item.title }}</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<view v-if="false" class="Bottom-UserInfo">
|
<view v-if="false" class="Bottom-UserInfo">
|
||||||
@@ -217,4 +217,4 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import './e-swiper.scss';
|
@import './e-swiper.scss';
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<tm-poup v-model="isShow" width="80vw" height="800rpx" position="center" :round="6" @change="fnOnChange">
|
||||||
|
<view class="fulled pa-4">
|
||||||
|
<view class="mt-24 fulled text-weight-b text-size-sm text-align-center text-overflow-2 pb-24">{{ title }}</view>
|
||||||
|
<view class="fulled mt-2">
|
||||||
|
<scroll-view class="fulled" scroll-y :style="{
|
||||||
|
height: url? '600rpx': '680rpx'
|
||||||
|
}">
|
||||||
|
<mp-html class="evan-markdown" lazy-load :domain="markdownConfig.domain"
|
||||||
|
:loading-img="markdownConfig.loadingGif" :scroll-table="true" :selectable="true"
|
||||||
|
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
||||||
|
:content="content" :markdown="true" :showLineNumber="true" :showLanguageName="true"
|
||||||
|
:copyByLongPress="true"/>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
<view v-if="url" class="fulled mt-12 flex flex-center">
|
||||||
|
<tm-button theme="bg-gradient-light-blue-accent" size="m" @click="fnToWebview()">
|
||||||
|
点击跳转内容链接
|
||||||
|
</tm-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</tm-poup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||||
|
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||||
|
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||||
|
|
||||||
|
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'notify-dialog',
|
||||||
|
components: {
|
||||||
|
tmPoup,
|
||||||
|
tmButton,
|
||||||
|
mpHtml
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isShow: false,
|
||||||
|
markdownConfig: MarkdownConfig,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.isShow = this.show;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fnToWebview() {
|
||||||
|
if (this.$utils.checkIsUrl(this.url)) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesC/website/website?data=' +
|
||||||
|
JSON.stringify({
|
||||||
|
title: this.title,
|
||||||
|
url: encodeURIComponent(this.url)
|
||||||
|
}),
|
||||||
|
success: () => {
|
||||||
|
this.fnOnChange(false)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fnOnChange(e) {
|
||||||
|
this.isShow = false;
|
||||||
|
this.$emit('on-change', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
+37
-2
@@ -4,12 +4,47 @@ export const _AppMockJsonKey = 'APP_GLOBAL_MOCK_JSON';
|
|||||||
|
|
||||||
// 默认的应用设置
|
// 默认的应用设置
|
||||||
export const DefaultAppConfigs = {
|
export const DefaultAppConfigs = {
|
||||||
|
basicConfig: {
|
||||||
|
tokenConfig: {
|
||||||
|
personalToken: "",
|
||||||
|
}
|
||||||
|
},
|
||||||
loveConfig: {},
|
loveConfig: {},
|
||||||
imagesConfig: {},
|
imagesConfig: {},
|
||||||
authorConfig: {},
|
authorConfig: {},
|
||||||
appConfig: {},
|
appConfig: {},
|
||||||
pluginConfig: {},
|
pluginConfig: {
|
||||||
pageConfig: {}
|
toolsPlugin: {},
|
||||||
|
linksSubmitPlugin: {},
|
||||||
|
},
|
||||||
|
pageConfig: {
|
||||||
|
homeConfig: {
|
||||||
|
pageTitle: "首页",
|
||||||
|
useCategory: true,
|
||||||
|
bannerConfig: {
|
||||||
|
enabled: true,
|
||||||
|
showTitle: true,
|
||||||
|
showIndicator: true,
|
||||||
|
height: "400rpx",
|
||||||
|
dotPosition: "right",
|
||||||
|
type: "post",
|
||||||
|
list: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
categoryConfig: {
|
||||||
|
type: "list"
|
||||||
|
},
|
||||||
|
momentConfig: {
|
||||||
|
useTagRandomColor: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
auditConfig: {
|
||||||
|
auditModeEnabled: false,
|
||||||
|
auditModeData: {
|
||||||
|
jsonUrl: "",
|
||||||
|
jsonData: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import {getAppConfigs} from "@/config/index";
|
|
||||||
|
|
||||||
/** 配置后台管理员token */
|
|
||||||
const HaloTokenConfig = Object.freeze({
|
|
||||||
|
|
||||||
/** 基础请求域名:你的Halo博客基础域名 */
|
|
||||||
BASE_API: "",
|
|
||||||
// BASE_API: "https://blog.xiaoxiaomo.cn",
|
|
||||||
|
|
||||||
|
|
||||||
/** 管理员token */
|
|
||||||
systemToken: getAppConfigs()?.basicConfig?.tokenConfig?.personalToken,
|
|
||||||
/** 匿名用户token */
|
|
||||||
anonymousToken: ``
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
export default HaloTokenConfig;
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** 应用基础配置 */
|
||||||
|
const UHaloBaseConfig = Object.freeze({
|
||||||
|
|
||||||
|
/** 基础请求域名:你的Halo博客基础域名 */
|
||||||
|
BASE_API: "",
|
||||||
|
// 示例:
|
||||||
|
// BASE_API: "https://blog.xiaoxiaomo.cn",
|
||||||
|
|
||||||
|
// todo:可能有其他配置
|
||||||
|
})
|
||||||
|
|
||||||
|
export default UHaloBaseConfig;
|
||||||
@@ -4,6 +4,7 @@ import Vue from "vue";
|
|||||||
// 挂载全局工具类
|
// 挂载全局工具类
|
||||||
import utils from "./utils/index.js";
|
import utils from "./utils/index.js";
|
||||||
Vue.prototype.$utils = utils;
|
Vue.prototype.$utils = utils;
|
||||||
|
uni.$utils = utils;
|
||||||
|
|
||||||
// 全局统一样式的对话框
|
// 全局统一样式的对话框
|
||||||
import Fy from '@/js_sdk/fy-showModal/index.js'
|
import Fy from '@/js_sdk/fy-showModal/index.js'
|
||||||
@@ -57,7 +58,7 @@ Vue.prototype.$http = http;
|
|||||||
import ApiManager from '@/api/index.js'
|
import ApiManager from '@/api/index.js'
|
||||||
Vue.use(ApiManager);
|
Vue.use(ApiManager);
|
||||||
|
|
||||||
import HaloTokenConfig from '@/config/token.config.js'
|
import HaloTokenConfig from '@/config/uhalo.config.js'
|
||||||
Vue.prototype.$baseApiUrl = HaloTokenConfig.BASE_API
|
Vue.prototype.$baseApiUrl = HaloTokenConfig.BASE_API
|
||||||
|
|
||||||
// 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填
|
// 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
"name" : "uni-halo",
|
"name" : "uni-halo",
|
||||||
"appid" : "__UNI__5748B6E",
|
"appid" : "__UNI__5748B6E",
|
||||||
"description" : "uni-halo博客:基于halo开源博客系统API开发的多端博客。",
|
"description" : "uni-halo博客:基于halo开源博客系统API开发的多端博客。",
|
||||||
"versionName" : "1.0.0",
|
"versionName" : "2.0.8",
|
||||||
"versionCode" : 100,
|
"versionCode" : 208,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
"quickapp" : {},
|
"quickapp" : {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin" : {
|
||||||
"appid" : "wx1bb161867082c72f",
|
"appid" : "",
|
||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : false,
|
"urlCheck" : false,
|
||||||
"minified" : true
|
"minified" : true
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "uni-halo",
|
"name": "uni-halo",
|
||||||
"version": "1.0.0",
|
"version": "2.0.8",
|
||||||
"description": "<p align=\"center\">\r <img alt=\"logo\" src=\"https://b.925i.cn/uni_halo/uni_halo_logo.png\" width=\"120\" height=\"120\" style=\"margin-bottom: 10px;\">\r </p>\r <h3 align=\"center\" style=\"margin: 30px 0 30px;font-weight: bold;font-size:40px;\">uni-halo</h3>\r <h3 align=\"center\">uni-halo 基于Halo一款现代化的开源博客/CMS系统API开发的可多端编译应用</h3>",
|
"description": "<p align=\"center\">\r <img alt=\"logo\" src=\"https://b.925i.cn/uni_halo/uni_halo_logo.png\" width=\"120\" height=\"120\" style=\"margin-bottom: 10px;\">\r </p>\r <h3 align=\"center\" style=\"margin: 30px 0 30px;font-weight: bold;font-size:40px;\">uni-halo</h3>\r <h3 align=\"center\">uni-halo 基于Halo一款现代化的开源博客/CMS系统API开发的可多端编译应用</h3>",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -31,8 +31,15 @@ export default {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// 获取mockjson
|
// 获取mockjson
|
||||||
if (res.basicConfig.auditModeEnabled) {
|
if (res.auditConfig.auditModeEnabled) {
|
||||||
await uni.$tm.vx.actions('config/fetchMockJson')
|
if (res.auditConfig.auditModeData.jsonUrl) {
|
||||||
|
await uni.$tm.vx.actions('config/fetchMockJson')
|
||||||
|
} else {
|
||||||
|
const mockJson = uni.$utils.checkJsonAndParse(res.auditConfig.auditModeData.jsonData)
|
||||||
|
if (mockJson.ok) {
|
||||||
|
uni.$tm.vx.commit('config/setMockJson', mockJson.jsonData)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 进入检查
|
// 进入检查
|
||||||
|
|||||||
@@ -152,7 +152,9 @@ export default {
|
|||||||
},
|
},
|
||||||
copyrightConfig() {
|
copyrightConfig() {
|
||||||
return this.haloConfigs.basicConfig.copyrightConfig;
|
return this.haloConfigs.basicConfig.copyrightConfig;
|
||||||
}
|
}, calcAuditModeEnabled() {
|
||||||
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
haloConfigs: {
|
haloConfigs: {
|
||||||
@@ -180,10 +182,10 @@ export default {
|
|||||||
this.navList = [
|
this.navList = [
|
||||||
{
|
{
|
||||||
key: 'archives',
|
key: 'archives',
|
||||||
title: this.haloConfigs.basicConfig.auditModeEnabled ? '内容归档' : '文章归档',
|
title: this.calcAuditModeEnabled ? '内容归档' : '文章归档',
|
||||||
leftIcon: 'halocoloricon-classify',
|
leftIcon: 'halocoloricon-classify',
|
||||||
leftIconColor: 'red',
|
leftIconColor: 'red',
|
||||||
rightText: this.haloConfigs.basicConfig.auditModeEnabled ? '已归档的内容' : '已归档的文章',
|
rightText: this.calcAuditModeEnabled ? '已归档的内容' : '已归档的文章',
|
||||||
path: '/pagesA/archives/archives',
|
path: '/pagesA/archives/archives',
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
type: 'page',
|
type: 'page',
|
||||||
@@ -396,7 +398,7 @@ export default {
|
|||||||
url: '/pagesC/website/website?data=' +
|
url: '/pagesC/website/website?data=' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
title: item.text || this.$haloConfig.title,
|
title: item.text || this.$haloConfig.title,
|
||||||
url: item.path
|
url: encodeURIComponent(item.path)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,36 +1,66 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page" :style="{
|
||||||
|
padding:calcShowType==='list-post'? 0 : '24rpx 0'
|
||||||
|
}">
|
||||||
<view v-if="loading !== 'success'" class="loading-wrap">
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view v-else class="app-page-content">
|
<view v-else class="app-page-content" :class="[calcShowType==='list-post'?'list-post':'']">
|
||||||
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="height: 70vh;">
|
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="height: 70vh;">
|
||||||
<!-- 空布局 -->
|
<!-- 空布局 -->
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<tm-translate v-for="(item, index) in dataList" :key="index"
|
<block v-if="calcAuditModeEnabled || calcShowType==='list'">
|
||||||
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
|
<tm-translate v-for="(item, index) in dataList" :key="index"
|
||||||
:wait="calcAniWait(index)">
|
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
|
||||||
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
:wait="calcAniWait(index)">
|
||||||
<view class="content" @click="handleToCategory(item)">
|
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
||||||
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
<view class="content" @click="handleToCategory(item)">
|
||||||
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
||||||
共 {{ item.postCount }} 篇文章
|
<view v-if="!calcAuditModeEnabled"
|
||||||
</view>
|
style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||||
<view v-else style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
共 {{ item.postCount }} 篇文章
|
||||||
共 {{ item.postCount }} 篇内容
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</tm-translate>
|
||||||
|
<view class="load-text">{{ loadMoreText }}</view>
|
||||||
|
</block>
|
||||||
|
<view v-else-if="calcShowType==='list-post'" class="fulled flex" style="min-height:100vh">
|
||||||
|
<view class="bg-white" :style="{height: '100%'}">
|
||||||
|
<tm-sliderNav :list="categoryList" bg-color="white" color="light-blue" rang-key="displayName"
|
||||||
|
@change="fnOnCategoryChange"></tm-sliderNav>
|
||||||
</view>
|
</view>
|
||||||
</tm-translate>
|
<scroll-view class="right-content pt-12 pb-12" :scroll-y="true" :scroll-top="scrollTop"
|
||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue"
|
:scroll-with-animation="true" :refresher-enabled="true" :refresher-triggered="triggered"
|
||||||
icon="icon-angle-up"></tm-flotbutton>
|
:refresher-threshold="60" refresher-background="#fafafa"
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
@refresherrefresh="fnGetPostByCategory(true)" @scrolltolower="fnGetPostByCategory(false)"
|
||||||
|
@scroll="fnOnScroll" @touchmove.stop @touchstart="fnOnTouchStart" @touchend="fnOnTouchEnd"
|
||||||
|
@touchcancel="fnOnTouchEnd">
|
||||||
|
<view v-if="postList.length === 0" class="article-empty flex flex-center">
|
||||||
|
<tm-empty :size="120" icon="icon-shiliangzhinengduixiang-" label="该分类下暂无文章~"></tm-empty>
|
||||||
|
</view>
|
||||||
|
<block v-else>
|
||||||
|
<block v-for="(post, index) in postList" :key="post.spec.publishTime">
|
||||||
|
<tm-translate animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||||
|
<article-min-card :article="post" @on-click="fnToArticleDetail"></article-min-card>
|
||||||
|
</tm-translate>
|
||||||
|
</block>
|
||||||
|
<view class="load-text">{{ loadMoreText }}</view>
|
||||||
|
</block>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="flot-buttons">
|
||||||
|
<tm-button @click="fnScrollTop" size="m" :fab="true" theme="light-blue"
|
||||||
|
icon="icon-angle-up"></tm-button>
|
||||||
|
<tm-button v-if="!calcAuditModeEnabled" @click="fnChangeShowType" size="m" :fab="true" theme="light-blue"
|
||||||
|
:icon="calcShowType==='list'?'icon-align-left':'icon-all'"></tm-button>
|
||||||
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -39,20 +69,27 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
|
||||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||||
|
import tmFlowLayout from '@/tm-vuetify/components/tm-flowLayout/tm-flowLayout.vue';
|
||||||
|
import tmSliderNav from '@/tm-vuetify/components/tm-sliderNav/tm-sliderNav.vue';
|
||||||
|
import ArticleMinCard from '@/components/article-min-card/article-min-card.vue';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmFlotbutton,
|
tmButton,
|
||||||
tmTranslate,
|
tmTranslate,
|
||||||
tmEmpty,
|
tmEmpty,
|
||||||
mpHtml
|
mpHtml,
|
||||||
|
tmFlowLayout,
|
||||||
|
tmSliderNav,
|
||||||
|
ArticleMinCard
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -60,33 +97,65 @@ export default {
|
|||||||
loading: 'loading',
|
loading: 'loading',
|
||||||
queryParams: {
|
queryParams: {
|
||||||
size: 20,
|
size: 20,
|
||||||
page: 1
|
page: 1,
|
||||||
|
fieldSelector: ['spec.hideFromList=false']
|
||||||
},
|
},
|
||||||
hasNext: false,
|
hasNext: false,
|
||||||
dataList: [],
|
dataList: [],
|
||||||
|
categoryList: [],
|
||||||
isLoadMore: false,
|
isLoadMore: false,
|
||||||
loadMoreText: '加载中...'
|
loadMoreText: '加载中...',
|
||||||
|
currentCategoryConfig: {
|
||||||
|
type: "list"
|
||||||
|
},
|
||||||
|
currentCategoryName: "",
|
||||||
|
postQueryParams: {
|
||||||
|
size: 10,
|
||||||
|
page: 0,
|
||||||
|
},
|
||||||
|
postList: [],
|
||||||
|
triggered: false,
|
||||||
|
scrollTop: 0,
|
||||||
|
tempScrollTop: 0,
|
||||||
|
scrollTimeout: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
haloConfigs() {
|
haloConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs;
|
return this.$tm.vx.getters().getConfigs;
|
||||||
},
|
},
|
||||||
|
calcAuditModeEnabled() {
|
||||||
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
|
},
|
||||||
mockJson() {
|
mockJson() {
|
||||||
return this.$tm.vx.getters().getMockJson;
|
return this.$tm.vx.getters().getMockJson;
|
||||||
|
},
|
||||||
|
categoryConfig() {
|
||||||
|
return this.haloConfigs.pageConfig.categoryConfig
|
||||||
|
},
|
||||||
|
calcShowType() {
|
||||||
|
return this.currentCategoryConfig.type
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
watch: {
|
||||||
this.fnGetData();
|
categoryConfig: {
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
handler(newVal) {
|
||||||
|
console.log("执行了", newVal)
|
||||||
|
if (!newVal) return;
|
||||||
|
this.currentCategoryConfig = newVal
|
||||||
|
this.handleInitPage()
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.isLoadMore = false;
|
this.isLoadMore = false;
|
||||||
this.queryParams.page = 0;
|
this.queryParams.page = 0;
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '没有更多数据了'
|
title: '没有更多数据了'
|
||||||
@@ -94,7 +163,12 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
if (this.calcShowType === 'list') {
|
||||||
|
|
||||||
|
this.queryParams.page += 1;
|
||||||
|
} else {
|
||||||
|
this.postQueryParams.page += 1;
|
||||||
|
}
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
} else {
|
} else {
|
||||||
@@ -105,8 +179,37 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
fnChangeShowType() {
|
||||||
|
if (this.calcShowType === 'list-post') {
|
||||||
|
this.currentCategoryConfig.type = 'list'
|
||||||
|
} else {
|
||||||
|
this.currentCategoryConfig.type = 'list-post'
|
||||||
|
}
|
||||||
|
this.handleInitPage();
|
||||||
|
},
|
||||||
|
handleResetInit() {
|
||||||
|
this.postList = []
|
||||||
|
this.dataList = []
|
||||||
|
this.categoryList = []
|
||||||
|
this.queryParams.page = 0;
|
||||||
|
this.postQueryParams.page = 0;
|
||||||
|
this.hasNext = false
|
||||||
|
this.isLoadMore = false
|
||||||
|
this.loadMoreText = '加载中...'
|
||||||
|
this.currentCategoryName = ""
|
||||||
|
this.triggered = false
|
||||||
|
this.fnResetSetAniWaitIndex()
|
||||||
|
},
|
||||||
|
handleInitPage() {
|
||||||
|
this.handleResetInit()
|
||||||
|
if (this.calcShowType === 'list-post') {
|
||||||
|
this.queryParams.size = 99999
|
||||||
|
}
|
||||||
|
this.fnGetData();
|
||||||
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
|
this.categoryConfig.type = "list"
|
||||||
this.dataList = this.mockJson.category.list.map((item) => {
|
this.dataList = this.mockJson.category.list.map((item) => {
|
||||||
return {
|
return {
|
||||||
metadata: {
|
metadata: {
|
||||||
@@ -139,21 +242,37 @@ export default {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('请求结果:');
|
console.log('请求结果:');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
if (this.calcShowType === 'list') {
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
|
// 处理数据
|
||||||
|
this.hasNext = res.hasNext;
|
||||||
|
|
||||||
this.loading = 'success';
|
const tempItems = res.items.map(item => {
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
|
||||||
// 处理数据
|
return item;
|
||||||
this.hasNext = res.hasNext;
|
})
|
||||||
|
|
||||||
const tempItems = res.items.map(item => {
|
if (this.isLoadMore) {
|
||||||
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
|
this.dataList = this.dataList.concat(tempItems);
|
||||||
return item;
|
} else {
|
||||||
})
|
this.dataList = tempItems;
|
||||||
|
}
|
||||||
if (this.isLoadMore) {
|
|
||||||
this.dataList = this.dataList.concat(tempItems);
|
|
||||||
} else {
|
} else {
|
||||||
this.dataList = tempItems;
|
this.dataList = res.items
|
||||||
|
this.categoryList = res.items.map(item => {
|
||||||
|
return {
|
||||||
|
displayName: item.spec.displayName,
|
||||||
|
name: item.metadata.name,
|
||||||
|
...item,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.triggered = false;
|
||||||
|
this.loading = 'success';
|
||||||
|
if (this.dataList.length !== 0) {
|
||||||
|
this.currentCategoryName = this.dataList[0].metadata.name;
|
||||||
|
this.fnGetPostByCategory()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@@ -175,12 +294,90 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleToCategory(data) {
|
handleToCategory(data) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
fnGetPostByCategory(isPulldownRefresh = true, triggered = true) {
|
||||||
|
if (!isPulldownRefresh) {
|
||||||
|
if (this.hasNext) {
|
||||||
|
this.postQueryParams.page += 1;
|
||||||
|
} else {
|
||||||
|
return uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.postQueryParams.page = 0;
|
||||||
|
if (triggered) {
|
||||||
|
this.triggered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$httpApi.v2
|
||||||
|
.getCategoryPostList(this.currentCategoryName, this.postQueryParams)
|
||||||
|
.then(res => {
|
||||||
|
this.hasNext = res.hasNext;
|
||||||
|
|
||||||
|
if (!isPulldownRefresh) {
|
||||||
|
this.postList = this.postList.concat(res.items);
|
||||||
|
} else {
|
||||||
|
this.postList = res.items;
|
||||||
|
}
|
||||||
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
this.loadMoreText = '加载失败!';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.triggered = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
fnOnCategoryChange(e) {
|
||||||
|
this.fnResetSetAniWaitIndex();
|
||||||
|
this.currentCategoryName = this.dataList[e].metadata.name;
|
||||||
|
this.fnToTopScroll();
|
||||||
|
this.postList = [];
|
||||||
|
this.fnGetPostByCategory();
|
||||||
|
},
|
||||||
|
|
||||||
|
fnOnScroll(e) {
|
||||||
|
this.tempScrollTop = e.detail.scrollTop;
|
||||||
|
},
|
||||||
|
fnToTopScroll() {
|
||||||
|
uni.pageScrollTo({
|
||||||
|
scrollTop: 0,
|
||||||
|
duration: 500
|
||||||
|
});
|
||||||
|
this.scrollTop = 0;
|
||||||
|
this.tempScrollTop = 0;
|
||||||
|
},
|
||||||
|
fnOnTouchStart() {
|
||||||
|
clearTimeout(this.scrollTimeout);
|
||||||
|
},
|
||||||
|
fnOnTouchEnd() {
|
||||||
|
this.scrollTimeout = setTimeout(() => {
|
||||||
|
this.scrollTop = this.tempScrollTop;
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
//跳转文章详情
|
||||||
|
fnToArticleDetail(post) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesA/article-detail/article-detail?name=' + post.metadata.name,
|
||||||
|
animationType: 'slide-in-right'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fnScrollTop() {
|
||||||
|
if (this.calcShowType === 'list') {
|
||||||
|
this.fnToTopPage()
|
||||||
|
} else {
|
||||||
|
this.fnToTopScroll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -212,8 +409,14 @@ export default {
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 0 12rpx;
|
padding: 0 12rpx;
|
||||||
gap: 20rpx 0;
|
gap: 20rpx 0;
|
||||||
|
|
||||||
|
&.list-post {
|
||||||
|
padding: 0;
|
||||||
|
gap: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.catgory-card {
|
.catgory-card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
@@ -236,6 +439,7 @@ export default {
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: rgba(0, 0, 0, 0.15);
|
background-color: rgba(0, 0, 0, 0.15);
|
||||||
|
backdrop-filter: blur(3rpx);
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,4 +459,14 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flot-buttons {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 100rpx;
|
||||||
|
right: 32rpx;
|
||||||
|
flex-direction: column;
|
||||||
|
display: flex;
|
||||||
|
gap: 6rpx;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<!-- 顶部切换 -->
|
<!-- 顶部切换 -->
|
||||||
<view class="e-fixed" v-if="category.list.length > 0">
|
<view class="e-fixed" v-if="category.list.length > 0">
|
||||||
<tm-tabs color="light-blue" v-model="category.activeIndex" range-key="displayName" :list="category.list"
|
<tm-tabs color="light-blue" :shadow="0" v-model="category.activeIndex" range-key="displayName" :list="category.list"
|
||||||
align="left" @change="fnOnCategoryChange"></tm-tabs>
|
align="left" @change="fnOnCategoryChange"></tm-tabs>
|
||||||
</view>
|
</view>
|
||||||
<!-- 占位区域 -->
|
<!-- 占位区域 -->
|
||||||
@@ -100,7 +100,10 @@ export default {
|
|||||||
},
|
},
|
||||||
mockJson() {
|
mockJson() {
|
||||||
return this.$tm.vx.getters().getMockJson;
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
},
|
||||||
|
calcAuditModeEnabled(){
|
||||||
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
galleryConfig: {
|
galleryConfig: {
|
||||||
@@ -120,7 +123,7 @@ export default {
|
|||||||
this.fnGetData(true);
|
this.fnGetData(true);
|
||||||
},
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '没有更多数据了'
|
title: '没有更多数据了'
|
||||||
@@ -148,7 +151,7 @@ export default {
|
|||||||
this.fnGetData(true);
|
this.fnGetData(true);
|
||||||
},
|
},
|
||||||
fnGetCategory() {
|
fnGetCategory() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
this.fnGetData(true);
|
this.fnGetData(true);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -169,7 +172,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fnGetData(isClearWaterfall = false) {
|
fnGetData(isClearWaterfall = false) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
this.dataList = this.mockJson.gallery.list.map(item => {
|
this.dataList = this.mockJson.gallery.list.map(item => {
|
||||||
return {
|
return {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|||||||
+100
-39
@@ -21,16 +21,18 @@
|
|||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view class="bg-white pb-24">
|
<view v-if="bannerConfig.enabled" class="bg-white pb-24">
|
||||||
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length !== 0">
|
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length !== 0">
|
||||||
<e-swiper
|
<e-swiper
|
||||||
height="400rpx"
|
:height="bannerConfig.height"
|
||||||
dotPosition="right"
|
:dotPosition="bannerConfig.dotPosition"
|
||||||
:autoplay="true"
|
:autoplay="true"
|
||||||
:useDot="false"
|
:useDot="bannerConfig.showIndicator"
|
||||||
:list="bannerList"
|
:showTitle="bannerConfig.showTitle"
|
||||||
@on-click="fnOnBannerClick"
|
:type="bannerConfig.type"
|
||||||
/>
|
:list="bannerList"
|
||||||
|
@on-click="fnOnBannerClick"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 精品分类 -->
|
<!-- 精品分类 -->
|
||||||
@@ -86,6 +88,11 @@
|
|||||||
icon="icon-angle-up"></tm-flotbutton>
|
icon="icon-angle-up"></tm-flotbutton>
|
||||||
</block>
|
</block>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 弹窗 -->
|
||||||
|
<NotifyDialog v-if="notify.show" :show="notify.show" :title="notify.data.title" :content="notify.data.content"
|
||||||
|
:url="notify.data.url" @on-change="fnOnNotifyChange"></NotifyDialog>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -98,6 +105,7 @@ import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
|||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
|
||||||
import eSwiper from '@/components/e-swiper/e-swiper.vue';
|
import eSwiper from '@/components/e-swiper/e-swiper.vue';
|
||||||
|
import NotifyDialog from "@/components/notify-dialog/notify-dialog.vue";
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -108,7 +116,8 @@ export default {
|
|||||||
tmFlotbutton,
|
tmFlotbutton,
|
||||||
tmIcons,
|
tmIcons,
|
||||||
tmEmpty,
|
tmEmpty,
|
||||||
eSwiper
|
eSwiper,
|
||||||
|
NotifyDialog
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -126,6 +135,10 @@ export default {
|
|||||||
noticeList: [],
|
noticeList: [],
|
||||||
articleList: [],
|
articleList: [],
|
||||||
categoryList: [],
|
categoryList: [],
|
||||||
|
notify: {
|
||||||
|
show: false,
|
||||||
|
data: {}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -145,14 +158,20 @@ export default {
|
|||||||
mockJson() {
|
mockJson() {
|
||||||
return this.$tm.vx.getters().getMockJson;
|
return this.$tm.vx.getters().getMockJson;
|
||||||
},
|
},
|
||||||
|
calcAuditModeEnabled() {
|
||||||
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
|
},
|
||||||
calcIsShowCategory() {
|
calcIsShowCategory() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled && this.categoryList.length !== 0) {
|
if (this.calcAuditModeEnabled && this.categoryList.length !== 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return this.haloConfigs.pageConfig.homeConfig.useCategory
|
return this.haloConfigs.pageConfig.homeConfig.useCategory
|
||||||
|
},
|
||||||
|
bannerConfig() {
|
||||||
|
return this.haloConfigs.pageConfig.homeConfig.bannerConfig
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@@ -167,7 +186,7 @@ export default {
|
|||||||
this.fnQuery();
|
this.fnQuery();
|
||||||
},
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '没有更多数据了'
|
title: '没有更多数据了'
|
||||||
@@ -187,13 +206,12 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fnQuery() {
|
fnQuery() {
|
||||||
console.log('this.mockJson', this.mockJson)
|
|
||||||
this.fnGetBanner();
|
this.fnGetBanner();
|
||||||
this.fnGetArticleList();
|
this.fnGetArticleList();
|
||||||
this.fnGetCategoryList();
|
this.fnGetCategoryList();
|
||||||
},
|
},
|
||||||
fnGetCategoryList() {
|
fnGetCategoryList() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
this.categoryList = this.mockJson.home.categoryList.map((item) => {
|
this.categoryList = this.mockJson.home.categoryList.map((item) => {
|
||||||
return {
|
return {
|
||||||
metadata: {
|
metadata: {
|
||||||
@@ -215,8 +233,8 @@ export default {
|
|||||||
|
|
||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getCategoryList({
|
.getCategoryList({
|
||||||
fieldSelector:['spec.hideFromList==false']
|
fieldSelector: ['spec.hideFromList=false']
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.categoryList = res.items.sort((a, b) => {
|
this.categoryList = res.items.sort((a, b) => {
|
||||||
return b.postCount - a.postCount;
|
return b.postCount - a.postCount;
|
||||||
@@ -239,7 +257,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取轮播图
|
// 获取轮播图
|
||||||
fnGetBanner() {
|
fnGetBanner() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
this.bannerList = this.mockJson.home.bannerList.map((item) => {
|
this.bannerList = this.mockJson.home.bannerList.map((item) => {
|
||||||
return {
|
return {
|
||||||
mp4: '',
|
mp4: '',
|
||||||
@@ -250,27 +268,37 @@ export default {
|
|||||||
createTime: item.time,
|
createTime: item.time,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
src: this.$utils.checkThumbnailUrl(item.cover),
|
src: this.$utils.checkThumbnailUrl(item.cover),
|
||||||
image: this.$utils.checkThumbnailUrl(item.cover)
|
image: this.$utils.checkThumbnailUrl(item.cover),
|
||||||
|
type: "custom",
|
||||||
|
content: "",
|
||||||
|
url: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const _this = this;
|
|
||||||
const _format = function (list) {
|
|
||||||
return list.map((item, index) => {
|
if (!this.bannerConfig.enabled) return;
|
||||||
|
|
||||||
|
if (this.bannerConfig.type === 'custom') {
|
||||||
|
this.bannerList = this.bannerConfig.list.map((item) => {
|
||||||
return {
|
return {
|
||||||
mp4: '',
|
mp4: '',
|
||||||
id: item.metadata.name,
|
id: Date.now() * Math.random(),
|
||||||
nickname: item.owner.displayName,
|
nickname: this.haloConfigs.authorConfig.blogger.nickname,
|
||||||
avatar: _this.$utils.checkAvatarUrl(item.owner.avatar),
|
avatar: this.$utils.checkAvatarUrl(this.haloConfigs.authorConfig.blogger.avatar),
|
||||||
address: '',
|
address: '',
|
||||||
createTime: uni.$tm.dayjs(item.spec.publishTime).fromNow(),
|
createTime: "",
|
||||||
title: item.spec.title,
|
title: item.title,
|
||||||
src: _this.$utils.checkThumbnailUrl(item.spec.cover),
|
src: this.$utils.checkThumbnailUrl(item.cover),
|
||||||
image: _this.$utils.checkThumbnailUrl(item.spec.cover)
|
image: this.$utils.checkThumbnailUrl(item.cover),
|
||||||
};
|
type: "custom",
|
||||||
});
|
content: item.content,
|
||||||
};
|
url: item.url
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const paramsStr = qs.stringify(this.queryParams, {
|
const paramsStr = qs.stringify(this.queryParams, {
|
||||||
allowDots: true,
|
allowDots: true,
|
||||||
@@ -283,20 +311,53 @@ export default {
|
|||||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
this.bannerList = _format(res.data.items);
|
this.bannerList = res.data.items.map((item, index) => {
|
||||||
|
return {
|
||||||
|
mp4: '',
|
||||||
|
id: item.metadata.name,
|
||||||
|
nickname: item.owner.displayName,
|
||||||
|
avatar: this.$utils.checkAvatarUrl(item.owner.avatar),
|
||||||
|
address: '',
|
||||||
|
createTime: uni.$tm.dayjs(item.spec.publishTime).fromNow(),
|
||||||
|
title: item.spec.title,
|
||||||
|
src: this.$utils.checkThumbnailUrl(item.spec.cover),
|
||||||
|
image: this.$utils.checkThumbnailUrl(item.spec.cover),
|
||||||
|
type: "post",
|
||||||
|
content: item.status.excerpt,
|
||||||
|
url: ""
|
||||||
|
};
|
||||||
|
});
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
fnOnBannerChange(e) {
|
fnOnNotifyChange(e) {
|
||||||
this.bannerCurrent = e.current;
|
this.notify.show = e;
|
||||||
},
|
},
|
||||||
fnOnBannerClick(item) {
|
fnOnBannerClick(item) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (item.type === 'custom') {
|
||||||
|
if (item.content) {
|
||||||
|
this.notify.data = item
|
||||||
|
this.notify.show = true
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (uni.$utils.checkIsUrl(item.url)) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesC/website/website?data=' +
|
||||||
|
JSON.stringify({
|
||||||
|
title: item.title || "加载中...",
|
||||||
|
url: encodeURIComponent(item.url)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.id === '') return;
|
if (item.id === '') return;
|
||||||
this.fnToArticleDetail({
|
this.fnToArticleDetail({
|
||||||
metadata: {
|
metadata: {
|
||||||
@@ -306,7 +367,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 文章列表
|
// 文章列表
|
||||||
fnGetArticleList() {
|
fnGetArticleList() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
this.articleList = this.mockJson.home.postList.map((item) => {
|
this.articleList = this.mockJson.home.postList.map((item) => {
|
||||||
return {
|
return {
|
||||||
metadata: {
|
metadata: {
|
||||||
@@ -371,7 +432,7 @@ export default {
|
|||||||
},
|
},
|
||||||
//跳转文章详情
|
//跳转文章详情
|
||||||
fnToArticleDetail(article) {
|
fnToArticleDetail(article) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -409,7 +470,7 @@ export default {
|
|||||||
|
|
||||||
// 根据slug查询分类下的文章
|
// 根据slug查询分类下的文章
|
||||||
fnToCategoryBy(category) {
|
fnToCategoryBy(category) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|||||||
+302
-247
@@ -1,67 +1,86 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view v-if="loading !== 'success'" class="loading-wrap">
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
|
||||||
<!-- 内容区域 -->
|
|
||||||
<view v-else class="app-page-content">
|
|
||||||
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
|
||||||
<!-- 空布局 -->
|
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
|
||||||
</view>
|
|
||||||
<block v-else>
|
|
||||||
<block v-for="(moment, index) in dataList" :key="index">
|
|
||||||
<!-- 卡片 -->
|
|
||||||
<tm-translate v-if="moment.spec.visible==='PUBLIC'" animation-name="fadeUp" :wait="calcAniWait()">
|
|
||||||
<view class="moment-card">
|
|
||||||
<view class="head" style="display: flex;align-items: center;">
|
|
||||||
<view class="avatar" style="flex-shrink: 0;">
|
|
||||||
<image style="width: 66rpx;height: 66rpx;border-radius: 50%;"
|
|
||||||
:src="moment.spec.user.avatar"/>
|
|
||||||
</view>
|
|
||||||
<view class="nickname" style="margin-left: 12rpx;">
|
|
||||||
<view style="font-size: 30rpx;font-weight: bold;color: #333333;">
|
|
||||||
{{ moment.spec.user.displayName }}
|
|
||||||
</view>
|
|
||||||
<view style="margin-top: 6rpx;font-size: 24rpx;color: #666;">
|
|
||||||
{{ {d: moment.spec.releaseTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="content">
|
|
||||||
<mp-html class="evan-markdown" lazy-load :domain="markdownConfig.domain"
|
|
||||||
:loading-img="markdownConfig.loadingGif" :scroll-table="true" :selectable="true"
|
|
||||||
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
|
||||||
:content="moment.spec.content.html" :markdown="true" :showLineNumber="true"
|
|
||||||
:showLanguageName="true" :copyByLongPress="true"/>
|
|
||||||
</view>
|
|
||||||
<view class="mb-12 mt--12" v-if="moment.videos.length!==0"
|
|
||||||
style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx; ">
|
|
||||||
<video
|
|
||||||
style="width:100%;height: 400rpx;border-radius: 12rpx;"
|
|
||||||
v-for="(video,index) in moment.videos"
|
|
||||||
:key="index" :src="video.url"></video>
|
|
||||||
</view>
|
|
||||||
<view v-if="moment.images.length!==0" class="images"
|
|
||||||
:class="['images-'+moment.images.length]">
|
|
||||||
<view class="image-item"
|
|
||||||
v-for="(image,mediumIndex) in moment.images"
|
|
||||||
:key="mediumIndex">
|
|
||||||
<image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;"
|
|
||||||
:src="image.url"
|
|
||||||
@click="handlePreview(mediumIndex,moment.images)"/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</tm-translate>
|
|
||||||
</block>
|
|
||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 内容区域 -->
|
||||||
|
<view v-else class="app-page-content">
|
||||||
|
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
||||||
|
<!-- 空布局 -->
|
||||||
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
|
</view>
|
||||||
|
<block v-else>
|
||||||
|
<block v-for="(moment, index) in dataList" :key="index">
|
||||||
|
<!-- 卡片 -->
|
||||||
|
<tm-translate v-if="moment.spec.visible==='PUBLIC'" animation-name="fadeUp" :wait="calcAniWait()">
|
||||||
|
<view class="moment-card">
|
||||||
|
<view class="head" style="display: flex;align-items: center;">
|
||||||
|
<view class="avatar" style="flex-shrink: 0;">
|
||||||
|
<image style="width: 66rpx;height: 66rpx;border-radius: 50%;"
|
||||||
|
:src="moment.spec.user.avatar"/>
|
||||||
|
</view>
|
||||||
|
<view class="nickname" style="margin-left: 12rpx;">
|
||||||
|
<view style="font-size: 30rpx;font-weight: bold;color: #333333;">
|
||||||
|
{{ moment.spec.user.displayName }}
|
||||||
|
</view>
|
||||||
|
<view style="margin-top: 6rpx;font-size: 24rpx;color: #666;">
|
||||||
|
{{ {d: moment.spec.releaseTime, f: 'yyyy年MM月dd日 星期w'} | formatTime }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content">
|
||||||
|
<mp-html class="evan-markdown" lazy-load :domain="markdownConfig.domain"
|
||||||
|
:loading-img="markdownConfig.loadingGif" :scroll-table="true" :selectable="true"
|
||||||
|
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
||||||
|
:content="moment.spec.newHtml" :markdown="true" :showLineNumber="true"
|
||||||
|
:showLanguageName="true" :copyByLongPress="true"/>
|
||||||
|
</view>
|
||||||
|
<view v-if="moment.images.length!==0" class="images"
|
||||||
|
:class="['images-'+moment.images.length]">
|
||||||
|
<view class="image-item"
|
||||||
|
v-for="(image,mediumIndex) in moment.images"
|
||||||
|
:key="mediumIndex">
|
||||||
|
<image mode="aspectFill" style="width: 100%;height: 100%;border-radius: 6rpx;"
|
||||||
|
:src="image.url"
|
||||||
|
@click="handlePreview(mediumIndex,moment.images)"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="moment.audios.length!==0" class="mb-12"
|
||||||
|
style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx;padding-right:28rpx;">
|
||||||
|
<audio
|
||||||
|
v-for="(audio,index) in moment.audios"
|
||||||
|
:controls="true"
|
||||||
|
:key="index"
|
||||||
|
:id="audio.url"
|
||||||
|
:poster="bloggerInfo.avatar"
|
||||||
|
:name="'来自' + (startConfig.title||bloggerInfo.nickname) + '的声音'"
|
||||||
|
:author="bloggerInfo.nickname"
|
||||||
|
:src="audio.url"></audio>
|
||||||
|
</view>
|
||||||
|
<view v-if="moment.videos.length!==0" class="mb-12"
|
||||||
|
style="display: flex; flex-direction: column; gap: 12rpx 0;padding: 0 24rpx; ">
|
||||||
|
<video
|
||||||
|
style="width:100%;height: 400rpx;border-radius: 12rpx;"
|
||||||
|
v-for="(video,index) in moment.videos"
|
||||||
|
:key="index" :src="video.url"></video>
|
||||||
|
</view>
|
||||||
|
<view v-if="moment.spec.tags && moment.spec.tags.length!==0" class="mt-12 px-16 pb-24 flex flex-wrap">
|
||||||
|
<tm-tags
|
||||||
|
v-for="(tag,tagIndex) in moment.spec.tags" :key="tagIndex"
|
||||||
|
:color="randomTagColor()" size="m" model="text">
|
||||||
|
{{ tag }}
|
||||||
|
</tm-tags>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</tm-translate>
|
||||||
|
</block>
|
||||||
|
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
||||||
|
<view class="load-text">{{ loadMoreText }}</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -69,226 +88,262 @@ import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
|||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
|
||||||
|
|
||||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||||
|
import {getRandomNumberByRange} from "@/utils/random.js"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmFlotbutton,
|
tmFlotbutton,
|
||||||
tmTranslate,
|
tmTranslate,
|
||||||
tmEmpty,
|
tmEmpty,
|
||||||
mpHtml
|
tmTags,
|
||||||
|
mpHtml
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
markdownConfig: MarkdownConfig,
|
||||||
|
loading: 'loading',
|
||||||
|
queryParams: {
|
||||||
|
size: 10,
|
||||||
|
page: 1
|
||||||
|
},
|
||||||
|
hasNext: false,
|
||||||
|
dataList: [],
|
||||||
|
isLoadMore: false,
|
||||||
|
loadMoreText: '加载中...',
|
||||||
|
tagColors: ['orange', 'green', 'red', 'blue']
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
bloggerInfo() {
|
||||||
|
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
||||||
|
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||||
|
return blogger;
|
||||||
},
|
},
|
||||||
data() {
|
haloConfigs() {
|
||||||
return {
|
return this.$tm.vx.getters().getConfigs;
|
||||||
markdownConfig: MarkdownConfig,
|
|
||||||
loading: 'loading',
|
|
||||||
queryParams: {
|
|
||||||
size: 10,
|
|
||||||
page: 1
|
|
||||||
},
|
|
||||||
hasNext: false,
|
|
||||||
dataList: [],
|
|
||||||
isLoadMore: false,
|
|
||||||
loadMoreText: '加载中...'
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
mockJson() {
|
||||||
computed: {
|
return this.$tm.vx.getters().getMockJson;
|
||||||
bloggerInfo() {
|
|
||||||
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
|
||||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
|
||||||
return blogger;
|
|
||||||
},
|
|
||||||
haloConfigs() {
|
|
||||||
return this.$tm.vx.getters().getConfigs;
|
|
||||||
},
|
|
||||||
mockJson() {
|
|
||||||
return this.$tm.vx.getters().getMockJson;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
calcAuditModeEnabled() {
|
||||||
onLoad() {
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
this.fnGetData();
|
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
calcUseTagRandomColor() {
|
||||||
this.isLoadMore = false;
|
return this.haloConfigs.pageConfig.momentConfig.useTagRandomColor
|
||||||
this.queryParams.page = 0;
|
|
||||||
this.fnGetData();
|
|
||||||
},
|
},
|
||||||
|
startConfig() {
|
||||||
onReachBottom(e) {
|
return this.haloConfigs.appConfig.startConfig;
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: '没有更多数据了'
|
|
||||||
});
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (this.hasNext) {
|
|
||||||
this.queryParams.page += 1;
|
|
||||||
this.isLoadMore = true;
|
|
||||||
this.fnGetData();
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: '没有更多数据了'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
},
|
||||||
fnGetData() {
|
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
|
||||||
this.dataList = this.mockJson.moments.list.map((item) => {
|
|
||||||
return {
|
|
||||||
metadata: {
|
|
||||||
name: Date.now() * Math.random(),
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
user: {
|
|
||||||
displayName: this.bloggerInfo.nickname,
|
|
||||||
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar),
|
|
||||||
},
|
|
||||||
content: {
|
|
||||||
html: item.content
|
|
||||||
},
|
|
||||||
releaseTime: item.time,
|
|
||||||
visible: "PUBLIC"
|
|
||||||
},
|
|
||||||
images: item.images.map((img) => {
|
|
||||||
return {
|
|
||||||
type: "PHOTO",
|
|
||||||
url: this.$utils.checkThumbnailUrl(img),
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
videos: []
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.loading = 'success';
|
|
||||||
this.loadMoreText = '呜呜,没有更多数据啦~';
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.stopPullDownRefresh();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.showLoading({
|
|
||||||
mask: true,
|
|
||||||
title: '加载中...'
|
|
||||||
});
|
|
||||||
// 设置状态为加载中
|
|
||||||
if (!this.isLoadMore) {
|
|
||||||
this.loading = 'loading';
|
|
||||||
}
|
|
||||||
this.loadMoreText = '加载中...';
|
|
||||||
this.$httpApi.v2
|
|
||||||
.getMomentList(this.queryParams)
|
|
||||||
.then(res => {
|
|
||||||
this.loading = 'success';
|
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
|
||||||
this.hasNext = res.hasNext;
|
|
||||||
|
|
||||||
const tempItems = res.items.map(item => {
|
onLoad() {
|
||||||
item.spec.user = {
|
this.fnGetData();
|
||||||
displayName: this.bloggerInfo.nickname,
|
},
|
||||||
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar)
|
onPullDownRefresh() {
|
||||||
}
|
this.isLoadMore = false;
|
||||||
item.spec.content.medium.map(medium => {
|
this.queryParams.page = 0;
|
||||||
medium.url = this.$utils.checkThumbnailUrl(medium.url, true)
|
this.fnGetData();
|
||||||
})
|
},
|
||||||
|
|
||||||
item['images'] = item.spec.content.medium
|
onReachBottom(e) {
|
||||||
.filter(x => x.type === 'PHOTO')
|
if (this.calcAuditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
item['videos'] = item.spec.content.medium
|
icon: 'none',
|
||||||
.filter(x => x.type === 'VIDEO')
|
title: '没有更多数据了'
|
||||||
return item;
|
});
|
||||||
})
|
return
|
||||||
|
|
||||||
if (this.isLoadMore) {
|
|
||||||
this.dataList = this.dataList.concat(tempItems);
|
|
||||||
} else {
|
|
||||||
this.dataList = tempItems;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.error(err);
|
|
||||||
this.loading = 'error';
|
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.stopPullDownRefresh();
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handlePreview(index, list) {
|
|
||||||
uni.previewImage({
|
|
||||||
current: index,
|
|
||||||
urls: list.map(item => item.url)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (this.hasNext) {
|
||||||
|
this.queryParams.page += 1;
|
||||||
|
this.isLoadMore = true;
|
||||||
|
this.fnGetData();
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fnGetData() {
|
||||||
|
if (this.calcAuditModeEnabled) {
|
||||||
|
this.dataList = this.mockJson.moments.list.map((item) => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
user: {
|
||||||
|
displayName: this.bloggerInfo.nickname,
|
||||||
|
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar),
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
html: item.content
|
||||||
|
},
|
||||||
|
releaseTime: item.time,
|
||||||
|
visible: "PUBLIC"
|
||||||
|
},
|
||||||
|
images: item.images.map((img) => {
|
||||||
|
return {
|
||||||
|
type: "PHOTO",
|
||||||
|
url: this.$utils.checkThumbnailUrl(img),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
videos: []
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
mask: true,
|
||||||
|
title: '加载中...'
|
||||||
|
});
|
||||||
|
// 设置状态为加载中
|
||||||
|
if (!this.isLoadMore) {
|
||||||
|
this.loading = 'loading';
|
||||||
|
}
|
||||||
|
this.loadMoreText = '加载中...';
|
||||||
|
this.$httpApi.v2
|
||||||
|
.getMomentList(this.queryParams)
|
||||||
|
.then(res => {
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
|
this.hasNext = res.hasNext;
|
||||||
|
|
||||||
|
const tempItems = res.items.map(item => {
|
||||||
|
item.spec.user = {
|
||||||
|
displayName: this.bloggerInfo.nickname,
|
||||||
|
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar)
|
||||||
|
}
|
||||||
|
item.spec.content.medium.map(medium => {
|
||||||
|
medium.url = this.$utils.checkThumbnailUrl(medium.url, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
item.spec.newHtml = this.removeTagLinksCompletely(item.spec.content.html, '')
|
||||||
|
item['images'] = item.spec.content.medium
|
||||||
|
.filter(x => x.type === 'PHOTO')
|
||||||
|
|
||||||
|
item['videos'] = item.spec.content.medium
|
||||||
|
.filter(x => x.type === 'VIDEO')
|
||||||
|
|
||||||
|
item['audios'] = item.spec.content.medium
|
||||||
|
.filter(x => x.type === 'AUDIO')
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
|
||||||
|
if (this.isLoadMore) {
|
||||||
|
this.dataList = this.dataList.concat(tempItems);
|
||||||
|
} else {
|
||||||
|
this.dataList = tempItems;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
this.loading = 'error';
|
||||||
|
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handlePreview(index, list) {
|
||||||
|
uni.previewImage({
|
||||||
|
current: index,
|
||||||
|
urls: list.map(item => item.url)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
removeTagLinksCompletely(htmlString) {
|
||||||
|
const regex = /<a\s+(?:[^>]*?\s+)?class=(['"])[^'"]*?\btag\b[^'"]*?\1[^>]*?>.*?<\/a>/gi;
|
||||||
|
const newHtml = htmlString.replace(regex, '');
|
||||||
|
return newHtml
|
||||||
|
// .replace(/<[^>]+>\s*<\/[^>]+>/g, '')
|
||||||
|
// .replace(/\s+/g, ' ')
|
||||||
|
// .trim();
|
||||||
|
},
|
||||||
|
randomTagColor() {
|
||||||
|
if (!this.calcUseTagRandomColor) return "blue";
|
||||||
|
const randomIndex = getRandomNumberByRange(0, this.tagColors.length);
|
||||||
|
return this.tagColors[randomIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 24rpx 0;
|
padding: 24rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.moment-card {
|
.moment-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0 24rpx;
|
margin: 0 24rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #ffff;
|
background-color: #ffff;
|
||||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.head {
|
.head {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.images {
|
.images {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
|
|
||||||
.image-item {
|
.image-item {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
padding: 6rpx;
|
padding: 6rpx;
|
||||||
width: 33%;
|
width: 33%;
|
||||||
height: 200rpx
|
height: 200rpx
|
||||||
}
|
}
|
||||||
|
|
||||||
&-1 {
|
&-1 {
|
||||||
> .image-item {
|
> .image-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 350rpx
|
height: 350rpx
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-2 {
|
&-2 {
|
||||||
> .image-item {
|
> .image-item {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
height: 250rpx
|
height: 250rpx
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::v-deep .uni-audio-default {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<!-- 加载完成区域 -->
|
<!-- 加载完成区域 -->
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view v-if="dataList.length === 0" class="list-empty flex flex-center">
|
<view v-if="dataList.length === 0" class="list-empty flex flex-center">
|
||||||
<tm-empty v-if="haloConfigs.basicConfig.auditModeEnabled" icon="icon-shiliangzhinengduixiang-" label="暂无归档的内容"></tm-empty>
|
<tm-empty v-if="calcAuditModeEnabled" icon="icon-shiliangzhinengduixiang-" label="暂无归档的内容"></tm-empty>
|
||||||
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
|
<tm-empty v-else icon="icon-shiliangzhinengduixiang-" label="暂无归档的文章"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="e-timeline tm-timeline mt-24">
|
<view v-else class="e-timeline tm-timeline mt-24">
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<view class="flex time text-weight-b mb-24">
|
<view class="flex time text-weight-b mb-24">
|
||||||
<text>{{ item.year }}年</text>
|
<text>{{ item.year }}年</text>
|
||||||
<text v-if="tab.activeIndex === 0">{{ item.month }}月</text>
|
<text v-if="tab.activeIndex === 0">{{ item.month }}月</text>
|
||||||
<view v-if="haloConfigs.basicConfig.auditModeEnabled" class="text-size-s text-grey-darken-1 ml-12">
|
<view v-if="calcAuditModeEnabled" class="text-size-s text-grey-darken-1 ml-12">
|
||||||
(共 {{ item.posts.length }} 篇内容)
|
(共 {{ item.posts.length }} 篇内容)
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="text-size-s text-grey-darken-1 ml-12">
|
<view v-else class="text-size-s text-grey-darken-1 ml-12">
|
||||||
@@ -128,7 +128,10 @@ export default {
|
|||||||
},
|
},
|
||||||
mockJson() {
|
mockJson() {
|
||||||
return this.$tm.vx.getters().getMockJson;
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
},
|
||||||
|
calcAuditModeEnabled() {
|
||||||
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
@@ -139,7 +142,7 @@ export default {
|
|||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
},
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '没有更多数据了'
|
title: '没有更多数据了'
|
||||||
@@ -165,7 +168,7 @@ export default {
|
|||||||
this.fnToTopPage();
|
this.fnToTopPage();
|
||||||
},
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
const dataList = this.mockJson.archives.list.map(item => {
|
const dataList = this.mockJson.archives.list.map(item => {
|
||||||
const date = new Date(item.time)
|
const date = new Date(item.time)
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
@@ -353,7 +356,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fnToArticleDetail(article) {
|
fnToArticleDetail(article) {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ import {
|
|||||||
getRestrictReadTypeName,
|
getRestrictReadTypeName,
|
||||||
getShowableContent
|
getShowableContent
|
||||||
} from "@/utils/restrictRead";
|
} from "@/utils/restrictRead";
|
||||||
import HaloTokenConfig from "@/config/token.config";
|
import HaloTokenConfig from "@/config/uhalo.config";
|
||||||
import RestrictReadSkeleton from "@/components/restrict-read-skeleton/restrict-read-skeleton.vue";
|
import RestrictReadSkeleton from "@/components/restrict-read-skeleton/restrict-read-skeleton.vue";
|
||||||
import TmImages from "@/tm-vuetify/components/tm-images/tm-images.vue";
|
import TmImages from "@/tm-vuetify/components/tm-images/tm-images.vue";
|
||||||
import TmInput from "@/tm-vuetify/components/tm-input/tm-input.vue";
|
import TmInput from "@/tm-vuetify/components/tm-input/tm-input.vue";
|
||||||
@@ -483,7 +483,11 @@ export default {
|
|||||||
const restrictRead = checkPostRestrictRead(this.result);
|
const restrictRead = checkPostRestrictRead(this.result);
|
||||||
|
|
||||||
if (restrictRead && toolsPluginEnabled) {
|
if (restrictRead && toolsPluginEnabled) {
|
||||||
const verifyCodeType = getAppConfigs().pluginConfig.toolsPlugin?.verifyCodeType;
|
let verifyCodeType = getAppConfigs().pluginConfig.toolsPlugin?.verifyCodeType;
|
||||||
|
const postVerifyCodeType = this.result?.metadata?.annotations?.verifyCodeType;
|
||||||
|
if (postVerifyCodeType) {
|
||||||
|
verifyCodeType = postVerifyCodeType;
|
||||||
|
}
|
||||||
if (verifyCodeType === 'scan') {
|
if (verifyCodeType === 'scan') {
|
||||||
const scanCodeUrl = getAppConfigs().pluginConfig.toolsPlugin?.scanCodeUrl;
|
const scanCodeUrl = getAppConfigs().pluginConfig.toolsPlugin?.scanCodeUrl;
|
||||||
this.verificationCodeModal.type = 'scan';
|
this.verificationCodeModal.type = 'scan';
|
||||||
@@ -1063,7 +1067,7 @@ export default {
|
|||||||
url: '/pagesC/website/website?data=' +
|
url: '/pagesC/website/website?data=' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
title: data.title,
|
title: data.title,
|
||||||
url: data.url
|
url: encodeURIComponent(data.url)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page" :class="{ 'is-balck grey-darken-6': isBlackTheme }">
|
<view class="app-page" :class="{ 'is-balck grey-darken-6': isBlackTheme }">
|
||||||
<!-- 顶部切换 -->
|
<!-- 顶部切换 -->
|
||||||
<view class="e-fixed shadow-2">
|
<view class="e-fixed shadow-1">
|
||||||
<tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue"
|
<tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue"
|
||||||
insert-color="light-blue" :clear="true" @input="fnOnSearch" @confirm="fnOnSearch"></tm-search>
|
insert-color="light-blue" :clear="true" @input="fnOnSearch" @confirm="fnOnSearch"></tm-search>
|
||||||
<tm-tabs v-if="false" color="light-blue" :shadow="0" v-model="tab.activeIndex" :list="tab.list"
|
<tm-tabs v-if="false" color="light-blue" :shadow="0" v-model="tab.activeIndex" :list="tab.list"
|
||||||
@@ -10,12 +10,15 @@
|
|||||||
<!-- 占位区域 -->
|
<!-- 占位区域 -->
|
||||||
<view style="width: 100vw;height: 100rpx;"></view>
|
<view style="width: 100vw;height: 100rpx;"></view>
|
||||||
<!-- 加载区域 -->
|
<!-- 加载区域 -->
|
||||||
<view v-if="loading != 'success'" class="loading-wrap pa-24">
|
<view v-if="loading == 'loading'" class="loading-wrap pa-24">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-else-if="loading == 'error'" class="content-empty flex flex-center">
|
||||||
|
<tm-empty icon="icon-wind-cry" label="搜索异常"></tm-empty>
|
||||||
|
</view>
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view v-else class="content">
|
<view v-else class="content">
|
||||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
|
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
|
||||||
@@ -32,7 +35,7 @@
|
|||||||
<rich-text style="font-size: 32rpx;font-weight: bold;color: #333;"
|
<rich-text style="font-size: 32rpx;font-weight: bold;color: #333;"
|
||||||
:nodes="article.title"></rich-text>
|
:nodes="article.title"></rich-text>
|
||||||
<rich-text style="font-size: 28rpx;margin-top: 16rpx;color: #555;"
|
<rich-text style="font-size: 28rpx;margin-top: 16rpx;color: #555;"
|
||||||
:nodes="article.content"></rich-text>
|
:nodes="article.description"></rich-text>
|
||||||
<text style="font-size: 24rpx;margin-top: 24rpx;color:#888">
|
<text style="font-size: 24rpx;margin-top: 24rpx;color:#888">
|
||||||
最近更新:{{ {d: article.updateTimestamp, f: 'yyyy年MM月dd日 HH点mm分ss秒'} | formatTime }}
|
最近更新:{{ {d: article.updateTimestamp, f: 'yyyy年MM月dd日 HH点mm分ss秒'} | formatTime }}
|
||||||
</text>
|
</text>
|
||||||
@@ -85,9 +88,12 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
haloConfigs() {
|
haloConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs;
|
return this.$tm.vx.getters().getConfigs;
|
||||||
},
|
},
|
||||||
|
calcAuditModeEnabled() {
|
||||||
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fnSetPageTitle('内容搜索');
|
this.fnSetPageTitle('内容搜索');
|
||||||
@@ -108,15 +114,6 @@ export default {
|
|||||||
fnOnTabChange(index) {
|
fnOnTabChange(index) {
|
||||||
this.fnResetSetAniWaitIndex();
|
this.fnResetSetAniWaitIndex();
|
||||||
this.dataList = [];
|
this.dataList = [];
|
||||||
const _sorts = {
|
|
||||||
0: '',
|
|
||||||
1: 'topPriority,createTime,desc',
|
|
||||||
2: 'topPriority,visits,desc',
|
|
||||||
3: 'topPriority,updateTime,desc',
|
|
||||||
4: 'topPriority,likes,desc'
|
|
||||||
};
|
|
||||||
this.queryParams.sort = _sorts[index];
|
|
||||||
this.dataList = [];
|
|
||||||
this.fnToTopPage();
|
this.fnToTopPage();
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
},
|
},
|
||||||
@@ -130,11 +127,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 设置状态为加载中
|
// 设置状态为加载中
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getPostListByKeyword(this.queryParams)
|
.getPostListByKeyword(this.queryParams)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -179,13 +176,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
padding-top: 24rpx;
|
padding-top: 24rpx;
|
||||||
|
|
||||||
.content-empty {
|
|
||||||
height: 60vh;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-empty {
|
||||||
|
height: 60vh;
|
||||||
|
}
|
||||||
|
|
||||||
.article-card {
|
.article-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -68,6 +68,18 @@ export default {
|
|||||||
this.queryParams.page = 0;
|
this.queryParams.page = 0;
|
||||||
this.fnGetData();
|
this.fnGetData();
|
||||||
},
|
},
|
||||||
|
onShareAppMessage() {
|
||||||
|
return {
|
||||||
|
title: this.pageTitle,
|
||||||
|
path: `/pagesA/category-detail/category-detail?name=${this.name}&title=${this.pageTitle}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShareTimeline() {
|
||||||
|
return {
|
||||||
|
title: this.pageTitle,
|
||||||
|
path: `/pagesA/category-detail/category-detail?name=${this.name}&title=${this.pageTitle}`
|
||||||
|
}
|
||||||
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<!-- 返回顶部 -->
|
<!-- 返回顶部 -->
|
||||||
<tm-flotbutton color="light-blue" @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton>
|
<tm-flotbutton color="light-blue" @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||||
<tm-flotbutton v-if="haloPluginConfigs.submitLink.enabled" :offset="[16,80]" label="申请"
|
<tm-flotbutton v-if="haloPluginConfigs.linksSubmitPlugin.enabled" :offset="[16,80]" label="申请"
|
||||||
actions-pos="left" :show-text="true" color="bg-gradient-orange-accent"
|
actions-pos="left" :show-text="true" color="bg-gradient-orange-accent"
|
||||||
@click="toSubmitLinkPage"></tm-flotbutton>
|
@click="toSubmitLinkPage"></tm-flotbutton>
|
||||||
<!-- 详情弹窗 -->
|
<!-- 详情弹窗 -->
|
||||||
@@ -166,7 +166,10 @@ export default {
|
|||||||
}
|
}
|
||||||
return 'https://image.thum.io/get/width/1000/crop/800/' + val;
|
return 'https://image.thum.io/get/width/1000/crop/800/' + val;
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
calcAuditModeEnabled() {
|
||||||
|
return this.haloConfigs.auditConfig.auditModeEnabled
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.fnSetPageTitle('友情链接');
|
this.fnSetPageTitle('友情链接');
|
||||||
@@ -210,8 +213,8 @@ export default {
|
|||||||
return this.linkGroupList.find(item => item.metadata.name === groupName)?.spec?.displayName || groupName || "未分组"
|
return this.linkGroupList.find(item => item.metadata.name === groupName)?.spec?.displayName || groupName || "未分组"
|
||||||
},
|
},
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.calcAuditModeEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.isLoadMore) {
|
if (!this.isLoadMore) {
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="startConfig.bgVideo" :loop="true"
|
<video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="$utils.checkUrl(startConfig.bgVideo)" :loop="true"
|
||||||
:autoplay="true" :muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
|
:autoplay="true" :muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
|
||||||
:show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false"
|
:show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false"
|
||||||
:show-progress="false"></video>
|
:show-progress="false"></video>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
<view class="poup pa-36" scroll-y="auto">
|
<view class="poup pa-36" scroll-y="auto">
|
||||||
<view class="info flex">
|
<view class="info flex">
|
||||||
<view class="poup-logo pa-4 shadow-24">
|
<view class="poup-logo pa-4 shadow-24">
|
||||||
<image :src="blogDetail.blogLogo" class="poup-logo_img" mode="aspectFill"></image>
|
<image :src="$utils.checkAvatarUrl(blogDetail.blogLogo)" class="poup-logo_img" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="pl-24 info-detail">
|
<view class="pl-24 info-detail">
|
||||||
<view class="poup-name text-size-lg text-weight-b">{{ blogDetail.blogName }}</view>
|
<view class="poup-name text-size-lg text-weight-b">{{ blogDetail.blogName }}</view>
|
||||||
@@ -97,6 +97,7 @@ import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue'
|
|||||||
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue'
|
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue'
|
||||||
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue'
|
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue'
|
||||||
import tmCoupon from '@/tm-vuetify/components/tm-coupon/tm-coupon.vue'
|
import tmCoupon from '@/tm-vuetify/components/tm-coupon/tm-coupon.vue'
|
||||||
|
import $utils from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -128,11 +129,14 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
$utils() {
|
||||||
|
return $utils
|
||||||
|
},
|
||||||
haloPluginConfigs(){
|
haloPluginConfigs(){
|
||||||
return this.$tm.vx.getters().getConfigs.pluginConfig;
|
return this.$tm.vx.getters().getConfigs.pluginConfig;
|
||||||
},
|
},
|
||||||
blogDetail() {
|
blogDetail() {
|
||||||
return this.haloPluginConfigs.submitLink;
|
return this.haloPluginConfigs.linksSubmitPlugin;
|
||||||
},
|
},
|
||||||
calcSiteThumbnail(val) {
|
calcSiteThumbnail(val) {
|
||||||
return val => {
|
return val => {
|
||||||
@@ -147,13 +151,13 @@ export default {
|
|||||||
return `
|
return `
|
||||||
博客名称:${this.blogDetail.blogName}
|
博客名称:${this.blogDetail.blogName}
|
||||||
博客地址:${this.blogDetail.blogUrl}
|
博客地址:${this.blogDetail.blogUrl}
|
||||||
博客logo:${this.blogDetail.blogLogo}
|
博客logo:${$utils.checkAvatarUrl(this.blogDetail.blogLogo)}
|
||||||
博客简介:${this.blogDetail.blogDesc}
|
博客简介:${this.blogDetail.blogDesc}
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
calcBlogCoupon() {
|
calcBlogCoupon() {
|
||||||
return {
|
return {
|
||||||
img: this.blogDetail.blogLogo,
|
img: $utils.checkAvatarUrl(this.blogDetail.blogLogo),
|
||||||
title: this.blogDetail.blogName,
|
title: this.blogDetail.blogName,
|
||||||
time: this.blogDetail.blogDesc,
|
time: this.blogDetail.blogDesc,
|
||||||
btnText: '友链详情'
|
btnText: '友链详情'
|
||||||
|
|||||||
@@ -13,9 +13,12 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
const {title, url} = JSON.parse(e.query.data);
|
const {title, url} = JSON.parse(e.data);
|
||||||
this.webUrl = url;
|
this.webUrl = decodeURIComponent(url);
|
||||||
this.fnSetPageTitle(title);
|
console.log("webUrl" + this.webUrl)
|
||||||
|
if (title) {
|
||||||
|
this.fnSetPageTitle(title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+10
-5
@@ -5,9 +5,10 @@
|
|||||||
* 时间:2024年06月22日 12:00:44
|
* 时间:2024年06月22日 12:00:44
|
||||||
* 版本:v0.1.0
|
* 版本:v0.1.0
|
||||||
*/
|
*/
|
||||||
import {DefaultAppConfigs, getAppConfigs, setAppConfigs,setAppMockJson,getAppMockJson} from '@/config/index.js'
|
import {DefaultAppConfigs, getAppConfigs, getAppMockJson, setAppConfigs, setAppMockJson} from '@/config/index.js'
|
||||||
import v2Config from '@/api/v2/all.config.js'
|
import v2Config from '@/api/v2/all.config.js'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
|
import {setTokens} from "@/utils/token";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
@@ -21,7 +22,7 @@ export default {
|
|||||||
return getAppConfigs()
|
return getAppConfigs()
|
||||||
},
|
},
|
||||||
getMockJson(state) {
|
getMockJson(state) {
|
||||||
if(state.mockJson) return state.mockJson;
|
if (state.mockJson) return state.mockJson;
|
||||||
return getAppMockJson()
|
return getAppMockJson()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -36,12 +37,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchConfigs({commit, dispatch}) {
|
fetchConfigs({state, commit, dispatch}) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const res = await v2Config.getAppConfigs()
|
const res = await v2Config.getAppConfigs()
|
||||||
if (res) {
|
if (res) {
|
||||||
commit('setConfigs', res)
|
commit('setConfigs', utils.deepMerge(DefaultAppConfigs, res))
|
||||||
|
|
||||||
|
// 存储token
|
||||||
|
if (res?.basicConfig?.tokenConfig) {
|
||||||
|
setTokens(res.basicConfig.tokenConfig)
|
||||||
|
}
|
||||||
resolve(res)
|
resolve(res)
|
||||||
} else {
|
} else {
|
||||||
dispatch("setDefaultAppSettings");
|
dispatch("setDefaultAppSettings");
|
||||||
@@ -65,7 +71,6 @@ export default {
|
|||||||
url: mockJsonUrl,
|
url: mockJsonUrl,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log("mockJson", res.data)
|
|
||||||
commit('setMockJson', res.data)
|
commit('setMockJson', res.data)
|
||||||
resolve({
|
resolve({
|
||||||
ok: true,
|
ok: true,
|
||||||
|
|||||||
@@ -15,13 +15,13 @@
|
|||||||
<!-- <view class="tm-poup-wk bottom">{{ show ? 'on' : 'off'}}</view> -->
|
<!-- <view class="tm-poup-wk bottom">{{ show ? 'on' : 'off'}}</view> -->
|
||||||
<scroll-view :animation="aniData" @click.stop.prevent="" class="tm-poup-wk dhshiKa" scroll-y="true" :class="[
|
<scroll-view :animation="aniData" @click.stop.prevent="" class="tm-poup-wk dhshiKa" scroll-y="true" :class="[
|
||||||
position_sv == 'top'?'round-b-' + round:'',
|
position_sv == 'top'?'round-b-' + round:'',
|
||||||
position_sv == 'bottom'?'round-t-' + round:'',
|
position_sv == 'bottom'?'round-t-' + round:'',
|
||||||
position_sv, aniOn ? 'on ' : 'off',
|
position_sv, aniOn ? 'on ' : 'off',
|
||||||
black_tmeme ? 'grey-darken-5 bk' : bgColor
|
black_tmeme ? 'grey-darken-5 bk' : bgColor
|
||||||
]" :style="{
|
]" :style="{
|
||||||
width: (position_sv == 'top' || position_sv == 'bottom') ? '100%' : width_w,
|
width: (position_sv == 'top' || position_sv == 'bottom') ? '100%' : width_w,
|
||||||
height: position_sv == 'right' || position_sv == 'left' ?'100%' : height_h,
|
height: position_sv == 'right' || position_sv == 'left' ?'100%' : height_h,
|
||||||
|
|
||||||
}">
|
}">
|
||||||
<view :class="[clssStyle]" >
|
<view :class="[clssStyle]" >
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
dhshiKa:true,//是否结束动画
|
dhshiKa:true,//是否结束动画
|
||||||
aniData:null,
|
aniData:null,
|
||||||
timdiiid:6369784254,
|
timdiiid:6369784254,
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
deactivated() {
|
deactivated() {
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
let t = this;
|
let t = this;
|
||||||
clearTimeout(this.timdiiid)
|
clearTimeout(this.timdiiid)
|
||||||
this.dhshiKa=false;
|
this.dhshiKa=false;
|
||||||
t.aniOn=false;
|
t.aniOn=false;
|
||||||
@@ -213,18 +213,18 @@
|
|||||||
open() {
|
open() {
|
||||||
let t = this;
|
let t = this;
|
||||||
clearTimeout(this.timdiiid)
|
clearTimeout(this.timdiiid)
|
||||||
|
|
||||||
|
|
||||||
this.dhshiKa=false
|
this.dhshiKa=false
|
||||||
this.aniOn=true;
|
this.aniOn=true;
|
||||||
|
|
||||||
this.createBtT(this.position_sv,'on').then(()=>{
|
this.createBtT(this.position_sv,'on').then(()=>{
|
||||||
t.dhshiKa=true
|
t.dhshiKa=true
|
||||||
|
|
||||||
t.isclick=false
|
t.isclick=false
|
||||||
// console.log('on');
|
// console.log('on');
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
//下至上。
|
//下至上。
|
||||||
createBtT(pos,type){
|
createBtT(pos,type){
|
||||||
@@ -239,60 +239,60 @@
|
|||||||
if(type=='on'){
|
if(type=='on'){
|
||||||
aniData.translateY('0%').step();
|
aniData.translateY('0%').step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
if(type=='off'){
|
if(type=='off'){
|
||||||
aniData.translateY('100%').step();
|
aniData.translateY('100%').step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
}else if(pos=='top'){
|
}else if(pos=='top'){
|
||||||
if(type=='on'){
|
if(type=='on'){
|
||||||
aniData.translateY('0%').step();
|
aniData.translateY('0%').step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
if(type=='off'){
|
if(type=='off'){
|
||||||
aniData.translateY('-100%').step();
|
aniData.translateY('-100%').step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
}else if(pos=='left'){
|
}else if(pos=='left'){
|
||||||
if(type=='on'){
|
if(type=='on'){
|
||||||
aniData.translateX('0%').step();
|
aniData.translateX('0%').step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
if(type=='off'){
|
if(type=='off'){
|
||||||
aniData.translateX('-100%').step();
|
aniData.translateX('-100%').step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
}else if(pos=='right'){
|
}else if(pos=='right'){
|
||||||
if(type=='on'){
|
if(type=='on'){
|
||||||
aniData.translateX('0%').step();
|
aniData.translateX('0%').step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
if(type=='off'){
|
if(type=='off'){
|
||||||
aniData.translateX('100%').step();
|
aniData.translateX('100%').step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
}else if(pos=='center'){
|
}else if(pos=='center'){
|
||||||
|
|
||||||
if(type=='on'){
|
if(type=='on'){
|
||||||
aniData.opacity(1).scale(1).step();
|
aniData.opacity(1).scale(1).step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
if(type=='off'){
|
if(type=='off'){
|
||||||
aniData.opacity(0).scale(0.6).step();
|
aniData.opacity(0).scale(0.6).step();
|
||||||
this.aniData = aniData.export()
|
this.aniData = aniData.export()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(res=>{
|
return new Promise(res=>{
|
||||||
t.timdiiid = setTimeout(()=>{
|
t.timdiiid = setTimeout(()=>{
|
||||||
t.aniData = null;
|
t.aniData = null;
|
||||||
@@ -319,7 +319,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
||||||
&.isClickbled {
|
&.isClickbled {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@
|
|||||||
transform: translateY(100%);
|
transform: translateY(100%);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.top {
|
&.top {
|
||||||
@@ -382,7 +382,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
|
|
||||||
|
|
||||||
.tm-poup-wk {
|
.tm-poup-wk {
|
||||||
position: static;
|
position: static;
|
||||||
|
|||||||
+42
-1
@@ -10,7 +10,7 @@
|
|||||||
* 修改时间:
|
* 修改时间:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import HaloTokenConfig from '@/config/token.config.js'
|
import HaloTokenConfig from '@/config/uhalo.config.js'
|
||||||
import {getAppConfigs} from '@/config/index.js'
|
import {getAppConfigs} from '@/config/index.js'
|
||||||
|
|
||||||
const utils = {
|
const utils = {
|
||||||
@@ -160,7 +160,48 @@ const utils = {
|
|||||||
urls: list,
|
urls: list,
|
||||||
loop: true
|
loop: true
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 检查是否为json字符串
|
||||||
|
* @param {Object} jsonStr 数据源
|
||||||
|
*/
|
||||||
|
checkJsonAndParse(jsonStr) {
|
||||||
|
try {
|
||||||
|
const jsonResult = JSON.parse(jsonStr);
|
||||||
|
return {
|
||||||
|
ok: true,
|
||||||
|
jsonData: jsonResult,
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
jsonData: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isObject(obj) {
|
||||||
|
return obj && typeof obj === 'object' && !Array.isArray(obj);
|
||||||
|
},
|
||||||
|
deepMerge(target, source) {
|
||||||
|
let output = Object.assign({}, target);
|
||||||
|
|
||||||
|
if (this.isObject(target) && this.isObject(source)) {
|
||||||
|
Object.keys(source).forEach(key => {
|
||||||
|
const targetValue = target[key];
|
||||||
|
const sourceValue = source[key];
|
||||||
|
|
||||||
|
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
|
||||||
|
output[key] = targetValue.concat(sourceValue);
|
||||||
|
} else if (this.isObject(targetValue) && this.isObject(sourceValue)) {
|
||||||
|
output[key] = this.deepMerge(targetValue, sourceValue);
|
||||||
|
} else {
|
||||||
|
output[key] = sourceValue;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -12,11 +12,11 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定范围生成随机数
|
* 指定范围生成随机数
|
||||||
* @param {Number} m
|
* @param {Number} m 最小值(包含)
|
||||||
* @param {Number} n
|
* @param {Number} n 最大(不包含)
|
||||||
* @return {Number}
|
* @return {Number} 随机值
|
||||||
*/
|
*/
|
||||||
export function GetRandomNumberByRange(m, n) {
|
export function getRandomNumberByRange(m, n) {
|
||||||
return Math.floor(Math.random() * (m - n) + n);
|
return Math.floor(Math.random() * (m - n) + n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,10 +26,10 @@ export function GetRandomNumberByRange(m, n) {
|
|||||||
* @param {*} min 最小值
|
* @param {*} min 最小值
|
||||||
* @param {*} max 最大值
|
* @param {*} max 最大值
|
||||||
*/
|
*/
|
||||||
export function GetRandomNumberArray(len, min, max) {
|
export function getRandomNumberArray(len, min, max) {
|
||||||
let arr = [];
|
let arr = [];
|
||||||
for (let index = 0; index < len; index++) {
|
for (let index = 0; index < len; index++) {
|
||||||
arr.push(GetRandomNumberByRange(min, max));
|
arr.push(getRandomNumberByRange(min, max));
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-22
@@ -1,39 +1,39 @@
|
|||||||
/**
|
/**
|
||||||
* 设置缓存
|
* 设置缓存
|
||||||
* @param {缓存key} key
|
* @param {string} key 缓存key
|
||||||
* @param {需要存储的缓存值} value
|
* @param {Object} value 需要存储的缓存值
|
||||||
* @param {过期时间,默认0表示永久有效} expire
|
* @param {number} expire 过期时间,默认0表示永久有效
|
||||||
*/
|
*/
|
||||||
export const setCache = (key, value, expire = 0) => {
|
export const setCache = (key, value, expire = 0) => {
|
||||||
let obj = {
|
let obj = {
|
||||||
data: value, //存储的数据
|
data: value, //存储的数据
|
||||||
time: Date.now() / 1000, //记录存储的时间戳
|
time: Date.now() / 1000, //记录存储的时间戳
|
||||||
expire: expire //记录过期时间,单位秒
|
expire: expire //记录过期时间,单位秒
|
||||||
}
|
}
|
||||||
uni.setStorageSync(key, JSON.stringify(obj))
|
uni.setStorageSync(key, JSON.stringify(obj))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取缓存
|
* 获取缓存
|
||||||
* @param {缓存key} key
|
* @param {string} key
|
||||||
*/
|
*/
|
||||||
export const getCache = (key) => {
|
export const getCache = (key) => {
|
||||||
let val = uni.getStorageSync(key)
|
let val = uni.getStorageSync(key)
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
val = JSON.parse(val)
|
val = JSON.parse(val)
|
||||||
if (val.expire && Date.now() / 1000 - val.time > val.expire) {
|
if (val.expire && Date.now() / 1000 - val.time > val.expire) {
|
||||||
uni.removeStorageSync(key)
|
uni.removeStorageSync(key)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
return val.data
|
return val.data
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除缓存
|
* 删除缓存
|
||||||
* @param {缓存key} key
|
* @param { string } key 缓存key
|
||||||
*/
|
*/
|
||||||
export const delCache = (key) => {
|
export const delCache = (key) => {
|
||||||
uni.removeStorageSync(key)
|
uni.removeStorageSync(key)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import {getCache, setCache} from "./storage";
|
||||||
|
import utils from "./index"
|
||||||
|
|
||||||
|
export const APP_TOKENS_KEY = "APP_TOKENS";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 tokens
|
||||||
|
*/
|
||||||
|
export function getTokens() {
|
||||||
|
const tokens = getCache(APP_TOKENS_KEY);
|
||||||
|
return tokens ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 tokens
|
||||||
|
*/
|
||||||
|
export function setTokens(value) {
|
||||||
|
setCache(APP_TOKENS_KEY, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 tokens
|
||||||
|
*/
|
||||||
|
export function updateTokens(value) {
|
||||||
|
if (!value) return false
|
||||||
|
const tokens = getTokens(APP_TOKENS_KEY);
|
||||||
|
if (!tokens) return false
|
||||||
|
setTokens(utils.deepMerge(tokens, value))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 系统token
|
||||||
|
*/
|
||||||
|
export function getPersonalToken() {
|
||||||
|
const tokens = getTokens(APP_TOKENS_KEY);
|
||||||
|
console.log("tokens", tokens)
|
||||||
|
return tokens?.personalToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 系统token
|
||||||
|
*/
|
||||||
|
export function setPersonalToken(personalToken) {
|
||||||
|
const tokens = getCache(APP_TOKENS_KEY);
|
||||||
|
if (!tokens) return false
|
||||||
|
tokens.personalToken = personalToken
|
||||||
|
updateTokens(tokens)
|
||||||
|
return true
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user