mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-11 12:49:30 +08:00
修改:简单兼容QQ小程序(未测试)
This commit is contained in:
@@ -73,7 +73,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 广告区域 -->
|
||||
<view v-if="haloAdConfig.articleDetail.use" class="ad-wrap ma-24 mb-0">
|
||||
<view
|
||||
v-if="haloAdConfig.articleDetail.use && (haloAdConfig.unitId || haloAdConfig.adpid)"
|
||||
class="ad-wrap ma-24 mb-0"
|
||||
>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<ad v-if="haloAdConfig.unitId" :unit-id="haloAdConfig.unitId"></ad>
|
||||
<!-- #endif -->
|
||||
@@ -101,7 +104,10 @@
|
||||
/>
|
||||
|
||||
<!-- 广告区域:微信/decloud申请 -->
|
||||
<view v-if="haloAdConfig.articleDetail.use" class="ad-wrap mt-24 mb-24 ">
|
||||
<view
|
||||
v-if="haloAdConfig.articleDetail.use && (haloAdConfig.unitId || haloAdConfig.adpid)"
|
||||
class="ad-wrap mt-24 mb-24 "
|
||||
>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<ad v-if="haloAdConfig.unitId" :unit-id="haloAdConfig.unitId"></ad>
|
||||
<!-- #endif -->
|
||||
@@ -657,6 +663,7 @@ export default {
|
||||
},
|
||||
fnSavePoster() {
|
||||
this.$refs.rCanvas.saveImage(this.poster.res.tempFilePath);
|
||||
uni.$tm.toast('保存成功');
|
||||
},
|
||||
fnShareTo() {
|
||||
// #ifdef MP-WEIXIN
|
||||
|
||||
+123
-133
@@ -3,19 +3,7 @@
|
||||
<view class="content pt-24 pb-24 round-4">
|
||||
<!-- 表单区域 -->
|
||||
<tm-form @submit="fnOnSubmit">
|
||||
<tm-input
|
||||
:auto-focus="true"
|
||||
name="content"
|
||||
:vertical="true"
|
||||
required
|
||||
:height="220"
|
||||
input-type="textarea"
|
||||
bg-color="grey-lighten-5"
|
||||
:maxlength="200"
|
||||
:borderBottom="false"
|
||||
placeholder="请输入内容,不超过200字符..."
|
||||
v-model="form.content"
|
||||
></tm-input>
|
||||
<tm-input :auto-focus="true" name="content" :vertical="true" required :height="220" input-type="textarea" bg-color="grey-lighten-5" :maxlength="200" :borderBottom="false" placeholder="请输入内容,不超过200字符..." v-model="form.content"></tm-input>
|
||||
<tm-input name="author" align="right" required title="我的昵称" placeholder="请输入您的昵称..." v-model="form.author"></tm-input>
|
||||
<tm-input name="email" align="right" title="邮箱地址" placeholder="请输入您的邮箱..." v-model="form.email"></tm-input>
|
||||
<tm-input name="authorUrl" align="right" title="我的网站" placeholder="请输入您的网址..." v-model="form.authorUrl"></tm-input>
|
||||
@@ -30,134 +18,136 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
|
||||
import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
|
||||
import tmSwitch from '@/tm-vuetify/components/tm-switch/tm-switch.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
import tmForm from '@/tm-vuetify/components/tm-form/tm-form.vue';
|
||||
import tmInput from '@/tm-vuetify/components/tm-input/tm-input.vue';
|
||||
import tmSwitch from '@/tm-vuetify/components/tm-switch/tm-switch.vue';
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tmForm,
|
||||
tmInput,
|
||||
tmSwitch,
|
||||
tmButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
postId: '',
|
||||
parentId: '',
|
||||
title: '', // 被回复的标题 type=user =用户名 否则为文章标题
|
||||
form: '',
|
||||
formPage: '', // 来自哪个页面
|
||||
type: 'post' // 来源文章/页面 还是用户 user=用户
|
||||
},
|
||||
form: {
|
||||
allowNotification: true,
|
||||
author: '', // 作者
|
||||
avatar: '',
|
||||
authorUrl: '', // 作者主页
|
||||
content: '', // 评论内容
|
||||
email: '', // 邮件
|
||||
parentId: 0,
|
||||
postId: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 评论游客信息
|
||||
wxLoginVisitorUser() {
|
||||
return uni.$tm.vx.getters().getWxLoginInfo;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.params = this.$Route.query;
|
||||
this.form.postId = this.params.id;
|
||||
if (this.params.type == 'user') {
|
||||
this.form.parentId = this.params.parentId;
|
||||
this.fnSetPageTitle('回复用户:' + this.params.title);
|
||||
} else {
|
||||
this.form.parentId = 0;
|
||||
this.fnSetPageTitle(this.params.title);
|
||||
}
|
||||
this.form.author = this.wxLoginVisitorUser.nickName;
|
||||
this.form.avatar = this.wxLoginVisitorUser.avatarUrl;
|
||||
this.form.email = this.wxLoginVisitorUser.email;
|
||||
this.form.authorUrl = this.wxLoginVisitorUser.url;
|
||||
},
|
||||
methods: {
|
||||
fnOnSubmit(e) {
|
||||
if (e === false) {
|
||||
return uni.$tm.toast('请检查所有的必填项是否填写完整!');
|
||||
}
|
||||
if (this.form.allowNotification && !this.form.email) {
|
||||
return uni.$tm.toast('未填写邮箱地址,将无法接收提醒!');
|
||||
}
|
||||
if (this.form.email && !uni.$tm.test.email(this.form.email)) {
|
||||
return uni.$tm.toast('请填写正确的邮箱地址!');
|
||||
}
|
||||
if (this.form.authorUrl && !uni.$tm.test.url(this.form.authorUrl)) {
|
||||
return uni.$tm.toast('请输入正确的Url地址!');
|
||||
}
|
||||
this.fnHandle();
|
||||
export default {
|
||||
components: {
|
||||
tmForm,
|
||||
tmInput,
|
||||
tmSwitch,
|
||||
tmButton
|
||||
},
|
||||
|
||||
fnHandle() {
|
||||
uni.showLoading({
|
||||
title: '正在提交...'
|
||||
});
|
||||
const _api = {
|
||||
sheets: this.$httpApi.postSheetsComments,
|
||||
posts: this.$httpApi.postCommentPost
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
postId: '',
|
||||
parentId: '',
|
||||
title: '', // 被回复的标题 type=user =用户名 否则为文章标题
|
||||
form: '',
|
||||
formPage: '', // 来自哪个页面
|
||||
type: 'post' // 来源文章/页面 还是用户 user=用户
|
||||
},
|
||||
form: {
|
||||
allowNotification: true,
|
||||
author: '', // 作者
|
||||
avatar: '',
|
||||
authorUrl: '', // 作者主页
|
||||
content: '', // 评论内容
|
||||
email: '', // 邮件
|
||||
parentId: 0,
|
||||
postId: 0
|
||||
}
|
||||
};
|
||||
_api[this.params.from](this.form)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
uni.$tm.toast('提交成功,待博主审核通过后即可展示!');
|
||||
// 更新评论者信息
|
||||
uni.$tm.vx.commit('user/setWxLoginInfo', {
|
||||
avatarUrl: this.wxLoginVisitorUser.avatarUrl,
|
||||
nickName: this.form.author,
|
||||
email: this.form.email,
|
||||
url: this.form.authorUrl
|
||||
});
|
||||
// 清空评论内容
|
||||
this.form.content = '';
|
||||
// 触发刷新评论(可能需要评论审核不会有改变)
|
||||
// uni.$emit(this.params.formPage + '_refresh');
|
||||
} else {
|
||||
uni.$tm.toast('操作失败,请重试!');
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.$tm.toast(err.message);
|
||||
},
|
||||
computed: {
|
||||
// 评论游客信息
|
||||
wxLoginVisitorUser() {
|
||||
return uni.$tm.vx.getters().getWxLoginInfo;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.params = this.$Route.query;
|
||||
this.form.postId = this.params.id;
|
||||
if (this.params.type == 'user') {
|
||||
this.form.parentId = this.params.parentId;
|
||||
this.fnSetPageTitle('回复用户:' + this.params.title);
|
||||
} else {
|
||||
this.form.parentId = 0;
|
||||
this.fnSetPageTitle(this.params.title);
|
||||
}
|
||||
this.form.author = this.wxLoginVisitorUser.nickName;
|
||||
this.form.avatar = this.wxLoginVisitorUser.avatarUrl;
|
||||
this.form.email = this.wxLoginVisitorUser.email;
|
||||
this.form.authorUrl = this.wxLoginVisitorUser.url;
|
||||
},
|
||||
methods: {
|
||||
fnOnSubmit(e) {
|
||||
console.log('提交评论');
|
||||
if (e === false) {
|
||||
return uni.$tm.toast('请检查所有的必填项是否填写完整!');
|
||||
}
|
||||
if (this.form.allowNotification && !this.form.email) {
|
||||
return uni.$tm.toast('未填写邮箱地址,将无法接收提醒!');
|
||||
}
|
||||
if (this.form.email && !uni.$tm.test.email(this.form.email)) {
|
||||
return uni.$tm.toast('请填写正确的邮箱地址!');
|
||||
}
|
||||
if (this.form.authorUrl && !uni.$tm.test.url(this.form.authorUrl)) {
|
||||
return uni.$tm.toast('请输入正确的Url地址!');
|
||||
}
|
||||
this.fnHandle();
|
||||
},
|
||||
|
||||
fnHandle() {
|
||||
uni.showLoading({
|
||||
title: '正在提交...'
|
||||
});
|
||||
const _api = {
|
||||
sheets: this.$httpApi.postSheetsComments,
|
||||
posts: this.$httpApi.postCommentPost
|
||||
};
|
||||
_api[this.params.from](this.form)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
uni.$tm.toast('提交成功,待博主审核通过后即可展示!');
|
||||
// 更新评论者信息
|
||||
uni.$tm.vx.commit('user/setWxLoginInfo', {
|
||||
avatarUrl: this.wxLoginVisitorUser.avatarUrl,
|
||||
nickName: this.form.author,
|
||||
email: this.form.email,
|
||||
url: this.form.authorUrl
|
||||
});
|
||||
// 清空评论内容
|
||||
this.form.content = '';
|
||||
// 触发刷新评论(可能需要评论审核不会有改变)
|
||||
// uni.$emit(this.params.formPage + '_refresh');
|
||||
} else {
|
||||
uni.$tm.toast('操作失败,请重试!');
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.$tm.toast(err.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
// background-color: #fafafd;
|
||||
background-color: #ffffff;
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
// background-color: #fafafd;
|
||||
background-color: #ffffff;
|
||||
|
||||
.content {
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
// box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
}
|
||||
.poup-content {
|
||||
width: 500rpx;
|
||||
|
||||
::v-deep {
|
||||
.slider_id {
|
||||
width: 100% !important;
|
||||
.content {
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
// box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
.poup-content {
|
||||
width: 500rpx;
|
||||
|
||||
::v-deep {
|
||||
.slider_id {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -4,14 +4,18 @@
|
||||
<view class="profile flex flex-col flex-center pa-36">
|
||||
<view class="avatar"><image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image></view>
|
||||
<view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
|
||||
<view class="desc mt-24 text-size-m text-grey-darken-3">{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}</view>
|
||||
<view class="desc mt-24 text-size-m text-grey-darken-3">
|
||||
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
|
||||
</view>
|
||||
<!-- 联系图标 -->
|
||||
<view class="mt-24 contact-icons">
|
||||
<!-- 放全部:似乎显得有点拥挤 -->
|
||||
<!-- <block v-for="(item, index) in result" :key="index"><text v-if="item.value" class="halocoloricon" :class="[item.icon, { 'ml-12': index != 0 }]"></text></block> -->
|
||||
<!-- 考虑放几个常用的就行 -->
|
||||
<text class="halocoloricon halocoloricon-qq"></text>
|
||||
<!-- #ifndef MP-QQ -->
|
||||
<text class="ml-12 halocoloricon halocoloricon-wechat"></text>
|
||||
<!-- #endif -->
|
||||
<text class="ml-12 halocoloricon halocoloricon-GitHub"></text>
|
||||
<text class="ml-12 halocoloricon halocoloricon-gitee"></text>
|
||||
<text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
|
||||
|
||||
Reference in New Issue
Block a user