hengmei-two/pagesB/articleDetail/articleDetail.vue

201 lines
7.9 KiB
Vue
Raw Normal View History

2021-08-19 06:40:59 +00:00
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'详情'" :statusTitle="true"></status-nav>
2021-08-26 09:57:04 +00:00
<view v-if="isLoading" :style="{paddingTop: statusHNH+'px'}" class="pad-zy32 pad-x180">
2021-08-19 06:40:59 +00:00
<view class="fon36 col3 bold mar-sx20" style="line-height: 50rpx;">{{detailObj.title}}</view>
<view class="disac mar-x20">
<image :src="headImg" style="width: 60rpx;height: 60rpx;border-radius: 100%;" mode="aspectFill"></image>
<view class="mar-z10">
<view class="fon28 col3">{{name}}</view>
<view class="fon20 col9" style="margin-top: 6rpx;">{{detailObj.published_at}}发布</view>
</view>
</view>
<!-- 内容详情 -->
<view class="fon28" style="color: #1A1A1A; line-height: 40rpx;">
<!-- <image class="mar-x20" src="/static/public/banner.png" style="height: 400rpx;width: 100%;" mode=""></image> -->
<!-- <view style="margin-bottom:50rpx;">屋基寨位于阿坝茂县松坪沟是典型的羌族聚居区有着鲜明的价值观和民族文化屋基寨美景屋基寨美景</view>
<view style="margin-bottom:50rpx;">山寨海拔3000米以上有川西独特的自然景色但是海拔高地势陡各类资源匮乏居民收入单一屋基寨地貌屋基寨地貌</view>
<view style="margin-bottom:50rpx;">成都恒美毛发医疗美容总经理徐军挺了解到当地居民希望发展旅游增加收入时便立即驱车前往屋基寨村民着盛装迎接恒美一行村民着盛装迎接恒美一行</view>
<view style="margin-bottom:50rpx;">徐军挺总经理建议做强乡村旅游要完善基础设施同时要保持乡村建筑风貌和地域文化特色还要完善服务标准提升消防安全水平</view>
<view style="margin-bottom:50rpx;">打造乡村旅游品牌形成示范带动作用参观了解村民居住环境参观了解村民居住环境了解村民们的生活习俗风土人情了解村民们的生活习俗风土人情</view> -->
<rich-text :nodes="content"></rich-text>
</view>
</view>
2021-08-26 09:57:04 +00:00
<view class="posixzy disjbac bacf pad-zy32 btnBKS">
<view class="posir">
<image @tap="backHome" class="posia backH" src="/static/public/back-home.png" mode="aspectFill"></image>
</view>
<view class="disac fon28 colf">
<view @tap="lianK" class="disac posir lianShare" style="background-color: #3875F6; border-top-left-radius: 51rpx;border-bottom-left-radius: 51rpx;">
<image src="/static/public/bottom-customer.png" class="mar-zy20" style="width: 47rpx;height: 47rpx;" mode="aspectFill"></image>
<view>联系客服</view>
<button v-if="haveImg" class="fon24 posia" style="opacity: 0;top: 0;left: 0;right: 0;bottom: 0;" open-type="contact"></button>
</view>
<view @tap="shareEv" class="disac posir lianShare" style="background-color: #38CE51;border-top-right-radius: 51rpx;border-bottom-right-radius: 51rpx;">
<image src="/static/public/bottom-shear.png" style="width: 47rpx;height: 47rpx;margin-left: 15rpx;margin-right: 8rpx;" mode="aspectFill"></image>
<view>分享给好友</view>
<button v-if="haveImg" class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;"></button>
</view>
</view>
</view>
<empower @buttonH="buttonH" :vision="vision" :isWhere="2" @cancleEv="cancleEv"></empower>
<!-- 底部客服 -->
<public-customer :nbottom="140"></public-customer>
2021-08-27 03:04:06 +00:00
<!-- 弹框 -->
<view v-if="isShowP" @touchmove.stop.prevent="moveHandle" class="disjcac posAll">
<view class="bacf radius20 width100 tank-box">
<view class="tc tank-box-itemone">请授权绑定手机号</view>
<view class="fon28 colf pad-x30 pad-zy30 tc disjb">
<view @tap="isShowP=false" class="pad-sx10 radius10 tank-btn" style="background-color: rgba(230, 230, 230,1);color: #000000;">暂不绑定</view>
<view class="pad-sx10 radius10 tank-btn posir pbackc">
立即绑定
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="posia syxzo">立即绑定</button>
</view>
</view>
</view>
</view>
2021-08-19 06:40:59 +00:00
</view>
</template>
<script>
2021-08-26 09:57:04 +00:00
import empower from '@/components/empower.vue';
2021-08-19 06:40:59 +00:00
export default {
2021-08-26 09:57:04 +00:00
components:{
empower
},
2021-08-19 06:40:59 +00:00
data() {
return {
statusHNH:uni.getStorageSync('statusHNH'),
publicColor:uni.getStorageSync('publicColor'),//主题颜色
headImg:'/static/public/like.png',
name:'恒美植发',
time:'2021-07-14 08:22',
showTop:false,
detailObj:{},//详情
content:'',//富文本详情
2021-08-26 09:57:04 +00:00
isLoading:false,
haveImg:true,
detailId:'',
invite_code:'',
2021-08-27 03:04:06 +00:00
vision:false,
isShowP:false
2021-08-26 09:57:04 +00:00
}
},
onShareAppMessage(res) {
var ya = this;
this.$requst.post('user/record',{type:'content',action:'share',id:this.detailObj.id}).then(res=>{console.log('分享成功:',res);},error=>{})
let maiOjb = {
e:4,//内容分享
c:this.detailObj.id*1,
t:new Date().getTime()//当前时间戳
2021-08-19 06:40:59 +00:00
}
2021-08-26 09:57:04 +00:00
this.$toolAll.tools.maiDian(maiOjb)
var shareObj = {
     title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
     path: `/pagesB/articleDetail/articleDetail?id=${this.detailId}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
     imageUrl: ''//自定义图片路径可以是本地文件路径、代码包文件路径或者网络图片路径支持PNG及JPG不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
  };
  return shareObj;
2021-08-19 06:40:59 +00:00
},
2021-08-22 08:53:12 +00:00
onShow() {
this.$toolAll.tools.isLogin()
},
2021-08-19 06:40:59 +00:00
onLoad(options) {
this.checkDetail(options.id)
2021-08-26 09:57:04 +00:00
this.detailId = options.id
if(options.invite_code!='' && options.invite_code!=undefined){
uni.login({
provider: 'weixin',
success: (res)=> {
if (res.code) {
var params = {
code:res.code,
invite_code:options.invite_code,//用户邀请码
}
this.$requst.post('user/login',params).then(res => {
if(res.data.token!=''){
if(res.data.is_active==0) {
this.vision = true
this.haveImg = false
}
}
},error => {})
}
},
});
}
2021-08-19 06:40:59 +00:00
},
methods: {
2021-08-27 03:04:06 +00:00
moveHandle(){//禁止底层滑动
return false
},
getphonenumber(e){//授权绑定手机号
if(e.detail.errMsg=="getPhoneNumber:ok"){
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
// console.log('手机号信息:',res);
if(res.code==0){
this.isShowP = false
this.$toolAll.tools.showToast('手机号绑定成功','success')
}
},error=>{})
} else {
this.isShowP = false
}
},
buttonH(e){//授权成功
2021-08-26 09:57:04 +00:00
this.haveImg = e
2021-08-27 03:04:06 +00:00
if(e) {
this.vision = false
this.isShowP = true
}
2021-08-26 09:57:04 +00:00
},
2021-08-27 03:04:06 +00:00
cancleEv(e){//取消授权
2021-08-26 09:57:04 +00:00
if(e==0) this.vision = false
},
backHome(){
uni.navigateTo({
url:'/pages/tabbar/pagehome/pagehome'
})
},
lianK(){//客服
// if(!this.jieDuan){
// let isAuth = this.$toolAll.tools.returnAuth()
// if(!isAuth){
if(this.haveImg == false) {
this.vision = true
} else {
this.$toolAll.tools.closeTimer()//清空埋点倒计时
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
let maiOjb = {
e:5,//内容咨询
t:new Date().getTime()//当前时间戳
}
this.$toolAll.tools.maiDian(maiOjb)
}
// } else this.jieDuan = true
// }
},
shareEv(){
if(this.haveImg == false) {
this.vision = true
}
},
2021-08-19 06:40:59 +00:00
checkDetail(id){
this.$requst.post('archives/detail',{id:id}).then(res=>{
// console.log('详情:',res);
if(res.code==0){
this.detailObj = res.data.detail
this.content = this.$toolAll.tools.escape2Html(res.data.detail.content)
uni.hideToast()
this.isLoading = true
}
},error=>{})
}
}
}
</script>
<style>
</style>