| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510 |
- <template>
- <view v-if="isShow">
- <view class="top">
- <view v-if="detail.imageList.length>0">
- <swiper autoplay="true"
- circular="true" duration="1000" class="act-img">
- <block v-for="(item, index) in detail.imageList" :key="index">
- <swiper-item autoplay="true">
- <image class="act-img" lazy-load="true" :src="item.url"
- mode="aspectFill"></image>
- </swiper-item>
- </block>
- </swiper>
- </view>
- <image :src="detail.pic" mode="aspectFill" class="act-img" v-else></image>
- <view class="title">{{detail.title}}</view>
- <view class="datas">浏览 {{detail.popularity}} 收藏 {{detail.collect}}</view>
-
- <view class="baoming-box">
- <view class="ddflex">
- <image src="../static/images/bmsj.png"></image>
- <text>报名时间</text>
- </view>
- <view class="baoming-time">{{formData(detail.enlistStartTime)}} 至 {{formData(detail.enlistEndTime)}}</view>
- <view class="ddflex" style="margin-top: 25rpx;">
- <image src="../static/images/bmfy.png" style="visibility: hidden;"></image>
- <text>活动时间</text>
- </view>
- <view class="baoming-time">
- {{formData(detail.startTime)}} 至 {{formData(detail.endTime)}}
- </view>
- </view>
-
- <view class="hddz-box" style="margin-top: 26rpx;" v-if="detail.address">
- <view class="ddflex">
- <image src="../static/images/hddz.png"></image>
- <text>活动地点</text>
- </view>
- <!-- v-if="detail.address" -->
- <view class="ddflex hddz-area" @click="openMap()">
- <view class="fflex tover">{{detail.address}}</view>
- <image src="../static/images/crico2.png" class="rico"></image>
- </view>
- </view>
- </view>
-
- <view class="date">
- <view class="datass ddflex" style="justify-content: space-between;" v-if="detail.card" @click="jumpUrl('/card/index/index?id='+detail.card.id)">
- <view class="ddflex">
- <image :src="detail.card.avatar?detail.card.avatar:'../../static/pages/images/userimg.png'" style="width:66rpx ;height: 66rpx;border-radius: 100%;" mode="aspectFill" class="dimg"></image>
- <view>
- <view style="font-size: 28rpx;font-weight: bold;color: #333333;line-height: 40rpx;">{{detail.card.realName}}</view>
- <view style="margin-top: 3rpx;" class="ddflex">
- <view class="user-tag">{{detail.card.companyName}}</view>
- <view class="user-tag">{{detail.card.jobName}}</view>
- <view class="user-tag">入司{{detail.card.inDate?monthDayDiff(detail.card.inDate):'1年'}}</view>
- </view>
- </view>
- </view>
- <image src="../static/images/crico2.png" class="rico"></image>
- </view>
- </view>
- <view class="det">
- <view class="tit ddflex">活动介绍<!-- <image src="../../static/pages/images/crico1.png" class="rico"></image> --></view>
- <view class="content">
- <mp-html :content="detail.text" :lazy-load="true" @imgtap="choose"></mp-html>
- </view>
- </view>
- <view class="savepadding"></view>
- <view class="bot fixed bgfff">
- <view class="savepadding ddflex" style="justify-content: space-between;">
- <view class="btnfot ddflex">
- <navigator class="botbtn" open-type="switchTab" url="/pages/index/index" hover-class="none">
- <image src="/static/pages/images/sy.png"></image>主页
- </navigator>
- <view class="botbtn" @tap="userBehavior(2)">
- <image src="/static/pages/images/shoucang_h.png" v-if="detail.isCollect"></image>
- <image src="/static/pages/images/shoucang.png" v-else></image>收藏
- </view>
- <view class="botbtn" @click="showShare"><image src="../static/images/fxico1_1.png"></image>分享</view>
- <!-- <button open-type="share" class="botbtn">
- <image src="../../static/pages/images/fxico1_1.png"></image>分享
- </button> -->
- </view>
- <view class="btns ddflex">
- <view class="btn" @click="jumpUrl('/match/activity/activity')" v-if="detail.isEnlist">查看报名</view>
- <block v-else>
- <view class="btn" @click="showPop()" v-if="detail.state == 2">立即报名</view>
- <view class="btn" v-if="detail.state == 3">报名结束</view>
- <view class="btn" v-if="detail.state == 4">活动中</view>
- <view class="btn end" v-if="detail.state == 5">活动结束</view>
- </block>
- </view>
- </view>
- </view>
- <view class="ceng" v-if="popShow" @click="hidePop()"></view>
- <view class="popup" v-if="popShow">
- <image src="../../static/pages/images/clear.png" class="close" @click="hidePop()"></image>
- <view class="p-title">{{detail.title}}</view>
- <view class="p-bri tovers">{{detail.brief}}</view>
- <view class="money free"><text>¥</text>{{price}}</view>
- <view class="pop-tit">报名项目</view>
- <view class="pop-con">
- <view class="p-list ddflex">
- <view :class="'li' + (priceIndex == index ? ' active' : '')" v-for="(item,index) in priceList" :key="index" @click="selProject(item,index)">{{item.title}}</view>
- </view>
- </view>
- <view class="pop-btn" @click="jumpUrl('/match/sign/sign?id=' + detail.id + '&priceId=' + priceId)">马上报名</view>
- </view>
- <v-share :hide-toast="hideShare" :product="detail" :code-url="codeUrl" @onFather="click"></v-share>
-
- <update-userinfonew :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfonew>
-
- </view>
- </template>
- <script>
- const req = require('../../utils/request.js');
- const api = require('../../utils/api.js');
- const util = require('../../utils/util.js');
- const app = getApp();
- import mpHtml from "../../components/mp-html/components/mp-html/mp-html";
- import vShare from "../components/share-activity/share.vue";
- export default {
- components: {
- mpHtml,
- vShare
- },
- data() {
- return {
- isShow: false,
- options: {},
- detail: {},
- isLogin: false,
- userinfovip: {},
- isIos: false,
- priceIndex: 0,
- priceList: [],
- popShow: false,
- priceId: '',
- price: 0,
- hideShare: true,
- codeUrl: '',
-
- isShowUpdate: false, //是否显示更新信息弹窗
- isUpdateInfo: false,//更新用户信息
- isUpdateMobile: false,//绑定手机号
-
- enterTime : '',//进入页面时间
- outTime : '',//页面卸载时间
- stayTime : 0//页面停留时间
- };
- },
- async onLoad(options) {
- uni.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- });
- this.options = options;
- if(options.shareId) req.setStorage('shareId',options.shareId)
- // req.silenceLogin(options.userId, '');
- // 朋友圈页面不调用登陆
- if(!this.options.isSharePYQ){
- await req.silenceLogin(options.userId, '');
- setTimeout(()=>{
- this.getUpdate()
- },500)
- }
- },
- async onShow() {
- this.enterTime = new Date();
- console.log('---用户进入时间---',this.enterTime);
- // this.isLogin = req.isAuth();
- // await this.loadCodeParams();
- if(!this.options.isSharePYQ){
- await req.silenceLogin(this.options.userId, '');
- }
- if(this.options.scene)
- this.options.id = this.options.scene
- await this.getConfig();
- await this.getData(true);
- if(this.isLogin){
- // await this.getuserVip();
- }
- this.userBehavior(4);
- await this.getPrice();
- },
- onHide(){
- // 用户退出时间
- this.outTime = new Date();
- //停留时间(毫秒)
- this.stayTime = (this.outTime.getTime() - this.enterTime.getTime());
- console.log('---用户浏览---',Math.ceil(this.stayTime/1000))
- req.saveBehaviorNew(this.detail.id,2,4,'','',this.options.userId,Math.ceil(this.stayTime/1000))
- },
- onUnload(){
- // 用户退出时间
- this.outTime = new Date();
- //停留时间(毫秒)
- this.stayTime = (this.outTime.getTime() - this.enterTime.getTime());
- console.log('---用户浏览总时长---',Math.ceil(this.stayTime/1000))
- req.saveBehaviorNew(this.detail.id,2,4,'','',this.options.userId,Math.ceil(this.stayTime/1000))
- },
- onReachBottom: function() {
- },
- onShareAppMessage: function() {
- let url = '/match/activityDetail/activityDetail?id=' + this.detail.id
- if(req.getStorage('userInfo')){
- url += '&userId=' + req.getStorage('userInfo').id
- }
- if(req.getStorage('userInfo').userType==1){
- url += '&shareId=' + req.getStorage('userInfo').saleNo
- }
- req.saveBehaviorNew(this.detail.id,2,6)
- return {
- title: this.detail.title,
- imageUrl: this.detail.pic,
- path: url
- };
- },
- onShareTimeline() {
- req.saveBehaviorNew(this.detail.id,2,6)
- return {
- title: this.detail.title,
- imageUrl: this.detail.pic,
- path: '/match/activityDetail/activityDetail',
- query:'id=' + this.detail.id+'&isSharePYQ=' + true +'&isShare=' + true+(req.getStorage('userInfo').userType==1?('&shareId='+req.getStorage('userInfo').saleNo):'')
- };
- },
- methods: {
- getConfig() {
- var _this = this;
- return new Promise((resolve, reject) => {
- req.getRequest('/api/other/config', {}, function(res) {
- _this.about = res;
- _this.getSystem();
- resolve();
- });
- });
- },
- getSystem(){
- if(uni.getSystemInfoSync().platform == 'ios'){
- if(this.about.is_open_iosPay == 1){
- this.isIos = false;
- }else{
- this.isIos = true;
- }
- }else{
- this.isIos = false;
- }
- },
- openMap(){
- let that = this;
- console.log('打开地图')
- uni.openLocation({
- latitude: Number(that.detail.lat),
- longitude: Number(that.detail.lng),
- address: that.detail.address,
- success: function () {
- console.log('success');
- },
- fail(res){
- console.log('fail=='+JSON.stringify(res))
- }
- })
- },
- getData(isShow){
- return new Promise((resolve, reject) => {
- req.getRequest('/api/match/detail',{id: this.options.id},res => {
- this.detail = res;
- this.isShow = true;
- resolve();
- },isShow);
- })
- },
- getPrice(){
- return new Promise((resolve, reject) => {
- req.getRequest('/api/match/price',{id: this.options.id},res=>{
- this.priceList = res;
- this.priceId = res[0].id;
- let price = 0;
- if(this.userinfovip.levelGrade>0&& !this.userinfovip.end){
- price = res[0].vipMoney;
- }else{
- price = res[0].money;
- }
- this.price = price;
- req.setStorage('actPrice',price)
- resolve();
- })
- })
- },
- getuserVip() {
- return new Promise((resolve,reject)=>{
- req.getRequest('/api/user/levelDetails', {}, data => {
- let expireTime = Array;
- if (data.expireTime) {
- expireTime = data.expireTime.split(" ");
- data.expireTime = data.expireTime.replace(/-/g, '/');
- } // 解决苹果不兼容---日期
- let nowTime = new Date().getTime();
- let endTime = new Date(data.expireTime).getTime();
- let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
- // console.log(times, nowTime, endTime, data.expireTime);
- this.userinfovip = data;
- if (times <= 0) {
- this.userinfovip.end = true;
- } else {
- this.userinfovip.end = false;
- }
- });
- resolve();
- })
- },
- formatTimeCommStr(dataStr) {
- return util.formatTimeCommStr(dataStr, 'M/D 00:00');
- },
- formData(validDate){
- let time = new Date(validDate.replace(/-/g, '/'));
- return util.formatTime(time).t2
- },
- formDataObj(validDate){
- let time = new Date(validDate.replace(/-/g, '/'));
- return util.formatTime(time)
- },
- formDatahd(){
- if(this.detail.startTime&&this.detail.endTime){}
- else return false
- return this.formDataObj(this.detail.startTime).t2==this.formDataObj(this.detail.endTime).t2?
- (this.formDataObj(this.detail.startTime).t2+' '+this.formDataObj(this.detail.startTime).t6+' - '+this.formDataObj(this.detail.endTime).t6)
- :(this.formDataObj(this.detail.startTime).t5+' - '+this.formDataObj(this.detail.endTime).t5)
- },
- getBrowse(){
- let params={
- bindId: this.options.id,
- type: 10
- }
- req.postRequest('/api/browse', params, data => {});
- },
- toActivity(item){
- uni.navigateTo({
- url: '/match/activityDetail/activityDetail?id=' + item.id
- })
- },
- choose: function () {
- let freshen = false;
- this.$emit('freshen', {
- detail: freshen
- });
- },
- // clickCollect(){
- // req.isLogin().then(success => {
- // if(success){
- // req.postRequest('/api/collect',{
- // bindId: this.detail.id,
- // type: 2
- // },res=>{
- // this.detail.isCollect = !this.detail.isCollect;
- // })
- // }
- // })
- // },
- // 用户行为
- userBehavior(type) {
- var dataP = {};
- dataP.type =2 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
- dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
- dataP.bindId = this.detail.id;
- req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
- if (type == 2) {
- this.detail.isCollect = !this.detail.isCollect;
- if(this.detail.isCollect){
- req.saveBehaviorNew(this.detail.id,2,2)
- }else{
- req.saveBehaviorNew(this.detail.id,2,16)
- }
- }
- if (type == 3) {
- this.cardInfo.follow = !this.cardInfo.follow
- }
- if(type == 4) {
- // req.saveBehaviorNew(this.detail.id,2,4)
- }
- });
- },
- showPop(){
- let that = this;
- that.jumpUrl('/match/sign/sign?id=' + that.detail.id);
- },
- hidePop(){
- this.popShow = false;
- },
- selProject(it,idx){
- if(this.priceIndex == idx) return false;
- this.priceIndex = idx;
- this.priceId = it.id;
- console.log('priceId==' + this.priceId)
- let price = 0;
- if(this.userinfovip.levelGrade>0&& !this.userinfovip.end){
- price = it.vipMoney;
- }else{
- price = it.money;
- }
- this.price = price;
- req.setStorage('actPrice',price)
- },
- jumpUrl(url){
- req.isLogin().then(success => {
- if(success){
- uni.navigateTo({
- url: url
- })
- }
- })
- this.hidePop();
- },
- showShare() {
- // console.log(11111,this.hideShare)
- // #ifdef H5
- this.setData({
- hideShare: false
- });
-
- // #endif
- // #ifndef H5
- req.isLogin().then(success => {
- // console.log(success)
- if (success) {
- this.getCodeUrl()
- this.setData({
- hideShare: false
- });
- // console.log(this.hideShare)
- }
- });
- // #endif
- },
- getCodeUrl() {
- let that = this;
- let scene = that.detail.id;
- // console.log(scene); //获取小程序码
- const params = {
- page: 'match/activityDetail/activityDetail',
- scene: scene
- };
- req.getRequest('/api/program/codev', params, url => {
- that.setData({
- codeUrl: url
- });
- });
- },
- click(e) {
- // console.log(e,"7899")
- this.hideShare = e
- },
- loadCodeParams() {
- let _ts = this;
- return new Promise((resolve, reject) => {
- let form = {
- scene: _ts.options.scene
- };
- if (!_ts.options.scene) {
- resolve();
- return false;
- }
- req.getRequest('/api/code/params', form, data => {
- let res = data.scene.split('_');
- this.options.id = res[0];
- req.setStorage('pidCode', data.userId);
- resolve();
- });
- });
- },
- monthDayDiff(date){
- return util.monthDayDiff(date)
- },
-
- closeUpdate(){
- this.isShowUpdate = false
- },
- updateInfo(e){
- this.isUpdateInfo = e;
- },
- updateMobile(e){
- this.isUpdateMobile = e;
- },
- getUpdate() {
- console.log('getUpdate')
- let userInfos = req.getStorage('userInfo')
- // if ((!userInfos.avatar || userInfos.avatar.indexOf('thirdwx.qlogo') > -1 || !userInfos.nickName || userInfos.nickName.indexOf('用户') > -1) ) {
- // console.log('没有昵称')
- // this.isShowUpdate = true;
- // this.isUpdateInfo = true;
- // return false;
- // }
- if(!userInfos.mobile){
- console.log('没有手机号')
- this.isShowUpdate = true
- this.isUpdateMobile = true
- return false;
- }
- return true;
- },
- }
- };
- </script>
- <style>
- @import "./activityDetail.css";
- </style>
|