mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2025-05-28 06:20:16 +09:00
update: 优化代码格式
This commit is contained in:
parent
f9fce7d0ed
commit
9721932c34
@ -4,169 +4,170 @@
|
|||||||
import HaloTokenConfig from '@/config/token.config.js'
|
import HaloTokenConfig from '@/config/token.config.js'
|
||||||
import HttpHandler from '@/common/http/request.js'
|
import HttpHandler from '@/common/http/request.js'
|
||||||
import {
|
import {
|
||||||
getCache
|
getCache
|
||||||
} from '@/utils/storage.js'
|
} from '@/utils/storage.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
* 获取文章列表
|
* 获取文章列表
|
||||||
* @param {Object} params 参数
|
* @param {Object} params 参数
|
||||||
*/
|
*/
|
||||||
getPostList: (params) => {
|
getPostList: (params) => {
|
||||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts`, params)
|
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts`, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据名称获取文章
|
* 根据名称获取文章
|
||||||
* @param {String} name 分类名称
|
* @param {String} name 分类名称
|
||||||
*/
|
*/
|
||||||
getPostByName: (name) => {
|
getPostByName: (name) => {
|
||||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {}, {
|
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {}, {
|
||||||
header: {
|
header: {
|
||||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索文章
|
* 搜索文章
|
||||||
* @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)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询分类列表
|
* 查询分类列表
|
||||||
* @param {Object} params 查询参数
|
* @param {Object} params 查询参数
|
||||||
*/
|
*/
|
||||||
getCategoryList: (params) => {
|
getCategoryList: (params) => {
|
||||||
return HttpHandler.Get('/apis/api.content.halo.run/v1alpha1/categories', params)
|
return HttpHandler.Get('/apis/api.content.halo.run/v1alpha1/categories', params)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 查询分类下的文章
|
* 查询分类下的文章
|
||||||
* @param {String} name 分类名称
|
* @param {String} name 分类名称
|
||||||
* @param {Object} params 查询参数
|
* @param {Object} params 查询参数
|
||||||
*/
|
*/
|
||||||
getCategoryPostList: (name, params) => {
|
getCategoryPostList: (name, params) => {
|
||||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories/${name}/posts`, params)
|
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories/${name}/posts`, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取评论列表接口(列表数据)
|
* 获取评论列表接口(列表数据)
|
||||||
* @param {Object} params 查询参数
|
* @param {Object} params 查询参数
|
||||||
*/
|
*/
|
||||||
getPostCommentList: (params) => {
|
getPostCommentList: (params) => {
|
||||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments`, params)
|
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments`, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取回复列表
|
* 获取回复列表
|
||||||
* @param {String} commentName 名称
|
* @param {String} commentName 名称
|
||||||
* @param {Object} params 查询参数
|
* @param {Object} params 查询参数
|
||||||
*/
|
*/
|
||||||
getPostCommentReplyList: (commentName, params) => {
|
getPostCommentReplyList: (commentName, params) => {
|
||||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, params)
|
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 提交评论
|
// 提交评论
|
||||||
addPostComment: (data) => {
|
addPostComment: (data) => {
|
||||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments`, data)
|
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments`, data)
|
||||||
},
|
},
|
||||||
// 提交回复
|
// 提交回复
|
||||||
addPostCommentReply: (commentName, data) => {
|
addPostCommentReply: (commentName, data) => {
|
||||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/replay`, data)
|
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/replay`, data)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取标签列表
|
* 获取标签列表
|
||||||
* @param {Object} params 查询参数
|
* @param {Object} params 查询参数
|
||||||
*/
|
*/
|
||||||
getTagList: (params) => {
|
getTagList: (params) => {
|
||||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags`, params)
|
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags`, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据标签获取文章列表
|
* 根据标签获取文章列表
|
||||||
* @param {String} tagName 参数
|
* @param {String} tagName 参数
|
||||||
* @param {Object} params 查询参数
|
* @param {Object} params 查询参数
|
||||||
*/
|
*/
|
||||||
getPostByTagName: (tagName, params) => {
|
getPostByTagName: (tagName, params) => {
|
||||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags/${tagName}/posts`, params)
|
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags/${tagName}/posts`, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取瞬间列表
|
* 获取瞬间列表
|
||||||
*/
|
*/
|
||||||
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
|
systemToken: HaloTokenConfig.systemToken
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询站点统计信息
|
* 查询站点统计信息
|
||||||
*/
|
*/
|
||||||
getBlogStatistics: () => {
|
getBlogStatistics: () => {
|
||||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/stats/-`, {})
|
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/stats/-`, {})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取相册分组
|
* 获取相册分组
|
||||||
*/
|
*/
|
||||||
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
|
systemToken: HaloTokenConfig.systemToken
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据分组获取相册
|
* 根据分组获取相册
|
||||||
*/
|
*/
|
||||||
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
|
systemToken: HaloTokenConfig.systemToken
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取友链
|
* 获取友链
|
||||||
*/
|
*/
|
||||||
getFriendLinkList: (params) => {
|
getFriendLinkList: (params) => {
|
||||||
return HttpHandler.Get(`/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links`, params)
|
return HttpHandler.Get(`/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links`, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验文章访问密码
|
* 校验文章访问密码
|
||||||
*/
|
*/
|
||||||
checkPostVerifyCode: (verifyCode, postId) => {
|
checkPostVerifyCode: (verifyCode, postId) => {
|
||||||
return HttpHandler.Get(`/tools/verificationCode/check?code=${verifyCode}`, null, {
|
return HttpHandler.Get(`/tools/verificationCode/check?code=${verifyCode}`, null, {
|
||||||
header: {
|
header: {
|
||||||
'Authorization': 'Tools工具箱插件设置的认证token',
|
'Authorization': 'Tools工具箱插件设置的认证token',
|
||||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||||
'Post-Id': postId
|
'Post-Id': postId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文章验证码
|
* 获取文章验证码
|
||||||
*/
|
*/
|
||||||
getPostVerifyCode: () => {
|
getPostVerifyCode: () => {
|
||||||
return HttpHandler.Get(`/tools/verificationCode/create`, null, {
|
return HttpHandler.Get(`/tools/verificationCode/create`, null, {
|
||||||
header: {
|
header: {
|
||||||
'Authorization': 'Tools工具箱插件设置的认证token'
|
'Authorization': 'Tools工具箱插件设置的认证token'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
1243
pages.json
1243
pages.json
File diff suppressed because it is too large
Load Diff
@ -1,142 +1,144 @@
|
|||||||
<template>
|
<template>
|
||||||
<tm-fullView>
|
<tm-fullView>
|
||||||
<tm-sheet :shadow="24">
|
<tm-sheet :shadow="24">
|
||||||
<tm-alerts label="观看视频即可获取注册码" close></tm-alerts>
|
<tm-alerts label="观看视频即可获取注册码" close></tm-alerts>
|
||||||
<tm-divider color="red" model="dashed" :text="codeDataShow?'请复制下方注册码':'请点击“获取注册码”'"></tm-divider>
|
<tm-divider color="red" model="dashed" :text="codeDataShow?'请复制下方注册码':'请点击“获取注册码”'"></tm-divider>
|
||||||
<view class="ma-20" v-show="!codeDataShow">
|
<view class="ma-20" v-show="!codeDataShow">
|
||||||
<tm-button theme="bg-gradient-orange-accent" :round="24" block @click="openVideoAd">获取注册码</tm-button>
|
<tm-button theme="bg-gradient-orange-accent" :round="24" block @click="openVideoAd">获取注册码</tm-button>
|
||||||
</view>
|
</view>
|
||||||
<view class="ma-20" v-show="codeDataShow">
|
<view class="ma-20" v-show="codeDataShow">
|
||||||
<tm-coupon :hdata="codeData" color="orange" @click="fnCopyCode"></tm-coupon>
|
<tm-coupon :hdata="codeData" color="orange" @click="fnCopyCode"></tm-coupon>
|
||||||
</view>
|
</view>
|
||||||
</tm-sheet>
|
</tm-sheet>
|
||||||
<!-- <tm-sheet :shadow="24">
|
<!-- <tm-sheet :shadow="24">
|
||||||
<tm-images @load="loadimg" src="https://picsum.photos/300?id=7"></tm-images>
|
<tm-images @load="loadimg" src="https://picsum.photos/300?id=7"></tm-images>
|
||||||
</tm-sheet> -->
|
</tm-sheet> -->
|
||||||
</tm-fullView>
|
</tm-fullView>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let videoAd = null;
|
let videoAd = null;
|
||||||
import tmFullView from "@/tm-vuetify/components/tm-fullView/tm-fullView.vue"
|
import tmFullView from "@/tm-vuetify/components/tm-fullView/tm-fullView.vue"
|
||||||
import tmMenubars from "@/tm-vuetify/components/tm-menubars/tm-menubars.vue"
|
import tmMenubars from "@/tm-vuetify/components/tm-menubars/tm-menubars.vue"
|
||||||
import tmSheet from "@/tm-vuetify/components/tm-sheet/tm-sheet.vue"
|
import tmSheet from "@/tm-vuetify/components/tm-sheet/tm-sheet.vue"
|
||||||
import tmAlerts from "@/tm-vuetify/components/tm-alerts/tm-alerts.vue"
|
import tmAlerts from "@/tm-vuetify/components/tm-alerts/tm-alerts.vue"
|
||||||
import tmDivider from "@/tm-vuetify/components/tm-divider/tm-divider.vue"
|
import tmDivider from "@/tm-vuetify/components/tm-divider/tm-divider.vue"
|
||||||
import tmCoupon from '@/tm-vuetify/components/tm-coupon/tm-coupon.vue'
|
import tmCoupon from '@/tm-vuetify/components/tm-coupon/tm-coupon.vue'
|
||||||
import tmButton from "@/tm-vuetify/components/tm-button/tm-button.vue"
|
import tmButton from "@/tm-vuetify/components/tm-button/tm-button.vue"
|
||||||
import tmImages from "@/tm-vuetify/components/tm-images/tm-images.vue"
|
import tmImages from "@/tm-vuetify/components/tm-images/tm-images.vue"
|
||||||
export default {
|
|
||||||
components: {
|
export default {
|
||||||
tmFullView,
|
components: {
|
||||||
tmMenubars,
|
tmFullView,
|
||||||
tmSheet,
|
tmMenubars,
|
||||||
tmAlerts,
|
tmSheet,
|
||||||
tmDivider,
|
tmAlerts,
|
||||||
tmCoupon,
|
tmDivider,
|
||||||
tmButton,
|
tmCoupon,
|
||||||
tmImages
|
tmButton,
|
||||||
},
|
tmImages
|
||||||
data() {
|
},
|
||||||
return {
|
data() {
|
||||||
adUnitId: '',
|
return {
|
||||||
codeDataShow: false,
|
adUnitId: '',
|
||||||
codeData: {
|
codeDataShow: false,
|
||||||
// img: 'https://lywq.muyin.site/logo.png',
|
codeData: {
|
||||||
title: "请获取",
|
// img: 'https://lywq.muyin.site/logo.png',
|
||||||
btnText: '复制',
|
title: "请获取",
|
||||||
time: '有效期5分钟',
|
btnText: '复制',
|
||||||
sale: '',
|
time: '有效期5分钟',
|
||||||
saleLable: '注册码',
|
sale: '',
|
||||||
saleSplit: ''
|
saleLable: '注册码',
|
||||||
}
|
saleSplit: ''
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
onLoad(options) {
|
},
|
||||||
// #ifdef MP-WEIXIN
|
onLoad(options) {
|
||||||
wx.hideShareMenu();
|
// #ifdef MP-WEIXIN
|
||||||
this.adLoad();
|
wx.hideShareMenu();
|
||||||
// #endif
|
this.adLoad();
|
||||||
uni.onCopyUrl((result) => {
|
// #endif
|
||||||
setTimeout(() => {
|
uni.onCopyUrl((result) => {
|
||||||
uni.setClipboardData({
|
setTimeout(() => {
|
||||||
data: "禁止复制哦",
|
uni.setClipboardData({
|
||||||
})
|
data: "禁止复制哦",
|
||||||
}, 1000);
|
})
|
||||||
})
|
}, 1000);
|
||||||
},
|
})
|
||||||
methods: {
|
},
|
||||||
adLoad() {
|
methods: {
|
||||||
if (wx.createRewardedVideoAd) {
|
adLoad() {
|
||||||
videoAd = wx.createRewardedVideoAd({
|
if (wx.createRewardedVideoAd) {
|
||||||
adUnitId: haloAdConfig.rewardedVideoAd //你的广告key
|
videoAd = wx.createRewardedVideoAd({
|
||||||
})
|
adUnitId: haloAdConfig.rewardedVideoAd //你的广告key
|
||||||
videoAd.onError(err => {})
|
})
|
||||||
videoAd.onClose((status) => {
|
videoAd.onError(err => {
|
||||||
if (status && status.isEnded || status === undefined) {
|
})
|
||||||
//这里写广告播放完成后的事件
|
videoAd.onClose((status) => {
|
||||||
this.getRegistrationCode();
|
if (status && status.isEnded || status === undefined) {
|
||||||
} else {
|
//这里写广告播放完成后的事件
|
||||||
// 广告播放未完成
|
this.getRegistrationCode();
|
||||||
}
|
} else {
|
||||||
})
|
// 广告播放未完成
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
openVideoAd: function() {
|
}
|
||||||
if (videoAd && haloAdConfig.rewardedVideoAd != '') {
|
},
|
||||||
videoAd.show().catch(err => {
|
openVideoAd: function () {
|
||||||
// 失败重试
|
if (videoAd && haloAdConfig.rewardedVideoAd != '') {
|
||||||
console.log("广告拉取失败")
|
videoAd.show().catch(err => {
|
||||||
videoAd.load().then(() => videoAd.show())
|
// 失败重试
|
||||||
})
|
console.log("广告拉取失败")
|
||||||
} else {
|
videoAd.load().then(() => videoAd.show())
|
||||||
this.getRegistrationCode();
|
})
|
||||||
}
|
} else {
|
||||||
},
|
this.getRegistrationCode();
|
||||||
getRegistrationCode() {
|
}
|
||||||
uni.showLoading({
|
},
|
||||||
title: '正在获取...'
|
getRegistrationCode() {
|
||||||
});
|
uni.showLoading({
|
||||||
this.$httpApi.v2.getPostVerifyCode()
|
title: '正在获取...'
|
||||||
.then(res => {
|
});
|
||||||
if (res.code === 200) {
|
this.$httpApi.v2.getPostVerifyCode()
|
||||||
uni.$tm.toast('获取成功!');
|
.then(res => {
|
||||||
this.codeData.title = res.data;
|
if (res.code === 200) {
|
||||||
this.codeDataShow = true;
|
uni.$tm.toast('获取成功!');
|
||||||
} else {
|
this.codeData.title = res.data;
|
||||||
uni.$tm.toast('操作失败,请重试!');
|
this.codeDataShow = true;
|
||||||
}
|
} else {
|
||||||
})
|
uni.$tm.toast('操作失败,请重试!');
|
||||||
.catch(err => {
|
}
|
||||||
uni.$tm.toast(err.message);
|
})
|
||||||
});
|
.catch(err => {
|
||||||
},
|
uni.$tm.toast(err.message);
|
||||||
fnCopyCode() {
|
});
|
||||||
uni.setClipboardData({
|
},
|
||||||
data: this.codeData.title,
|
fnCopyCode() {
|
||||||
showToast: false,
|
uni.setClipboardData({
|
||||||
success: () => {
|
data: this.codeData.title,
|
||||||
uni.showToast({
|
showToast: false,
|
||||||
icon: 'none',
|
success: () => {
|
||||||
title: '复制成功!'
|
uni.showToast({
|
||||||
});
|
icon: 'none',
|
||||||
setTimeout(() => {
|
title: '复制成功!'
|
||||||
uni.navigateBack()
|
});
|
||||||
}, 500);
|
setTimeout(() => {
|
||||||
},
|
uni.navigateBack()
|
||||||
fail: () => {
|
}, 500);
|
||||||
uni.showToast({
|
},
|
||||||
icon: 'none',
|
fail: () => {
|
||||||
title: '复制失败!'
|
uni.showToast({
|
||||||
});
|
icon: 'none',
|
||||||
}
|
title: '复制失败!'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user