activityDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <view v-if="isShow">
  3. <view class="top">
  4. <view v-if="detail.imageList.length>0">
  5. <swiper autoplay="true"
  6. circular="true" duration="1000" class="act-img">
  7. <block v-for="(item, index) in detail.imageList" :key="index">
  8. <swiper-item autoplay="true">
  9. <image class="act-img" lazy-load="true" :src="item.url"
  10. mode="aspectFill"></image>
  11. </swiper-item>
  12. </block>
  13. </swiper>
  14. </view>
  15. <image :src="detail.pic" mode="aspectFill" class="act-img" v-else></image>
  16. <view class="title">{{detail.title}}</view>
  17. <view class="datas">浏览 {{detail.popularity}} 收藏 {{detail.collect}}</view>
  18. <view class="baoming-box">
  19. <view class="ddflex">
  20. <image src="../static/images/bmsj.png"></image>
  21. <text>报名时间</text>
  22. </view>
  23. <view class="baoming-time">{{formData(detail.enlistStartTime)}} 至 {{formData(detail.enlistEndTime)}}</view>
  24. <view class="ddflex" style="margin-top: 25rpx;">
  25. <image src="../static/images/bmfy.png" style="visibility: hidden;"></image>
  26. <text>活动时间</text>
  27. </view>
  28. <view class="baoming-time">
  29. {{formData(detail.startTime)}} 至 {{formData(detail.endTime)}}
  30. </view>
  31. </view>
  32. <view class="hddz-box" style="margin-top: 26rpx;" v-if="detail.address">
  33. <view class="ddflex">
  34. <image src="../static/images/hddz.png"></image>
  35. <text>活动地点</text>
  36. </view>
  37. <!-- v-if="detail.address" -->
  38. <view class="ddflex hddz-area" @click="openMap()">
  39. <view class="fflex tover">{{detail.address}}</view>
  40. <image src="../static/images/crico2.png" class="rico"></image>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="date">
  45. <view class="datass ddflex" style="justify-content: space-between;" v-if="detail.card" @click="jumpUrl('/card/index/index?id='+detail.card.id)">
  46. <view class="ddflex">
  47. <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>
  48. <view>
  49. <view style="font-size: 28rpx;font-weight: bold;color: #333333;line-height: 40rpx;">{{detail.card.realName}}</view>
  50. <view style="margin-top: 3rpx;" class="ddflex">
  51. <view class="user-tag">{{detail.card.companyName}}</view>
  52. <view class="user-tag">{{detail.card.jobName}}</view>
  53. <view class="user-tag">入司{{detail.card.inDate?monthDayDiff(detail.card.inDate):'1年'}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. <image src="../static/images/crico2.png" class="rico"></image>
  58. </view>
  59. </view>
  60. <view class="det">
  61. <view class="tit ddflex">活动介绍<!-- <image src="../../static/pages/images/crico1.png" class="rico"></image> --></view>
  62. <view class="content" style="padding: 0 30rpx;">
  63. <mp-html :content="detail.text" :lazy-load="true" @imgtap="choose"></mp-html>
  64. </view>
  65. </view>
  66. <view class="savepadding"></view>
  67. <view class="bot fixed bgfff">
  68. <view class="savepadding ddflex" style="justify-content: space-between;">
  69. <view class="btnfot ddflex">
  70. <navigator class="botbtn" open-type="switchTab" url="" hover-class="none">
  71. <image src="/static/pages/images/sy.png"></image>主页
  72. </navigator>
  73. <view class="botbtn">
  74. <image src="/static/pages/images/shoucang_h.png" v-if="detail.isCollect"></image>
  75. <image src="/static/pages/images/shoucang.png" v-else></image>收藏
  76. </view>
  77. <view class="botbtn"><image src="../static/images/fxico1_1.png"></image>分享</view>
  78. <!-- <button open-type="share" class="botbtn">
  79. <image src="../../static/pages/images/fxico1_1.png"></image>分享
  80. </button> -->
  81. </view>
  82. <view class="btns ddflex">
  83. <view class="btn" v-if="detail.isEnlist">查看报名</view>
  84. <block v-else>
  85. <view class="btn" v-if="detail.state == 2">立即报名</view>
  86. <view class="btn" v-if="detail.state == 3">报名结束</view>
  87. <view class="btn" v-if="detail.state == 4">活动中</view>
  88. <view class="btn end" v-if="detail.state == 5">活动结束</view>
  89. </block>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="ceng" v-if="popShow" @click="hidePop()"></view>
  94. <view class="popup" v-if="popShow">
  95. <image src="../../static/pages/images/clear.png" class="close" @click="hidePop()"></image>
  96. <view class="p-title">{{detail.title}}</view>
  97. <view class="p-bri tovers">{{detail.brief}}</view>
  98. <view class="money free"><text>¥</text>{{price}}</view>
  99. <view class="pop-tit">报名项目</view>
  100. <view class="pop-con">
  101. <view class="p-list ddflex">
  102. <view :class="'li' + (priceIndex == index ? ' active' : '')" v-for="(item,index) in priceList" :key="index" @click="selProject(item,index)">{{item.title}}</view>
  103. </view>
  104. </view>
  105. <view class="pop-btn" 马上报名</view>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. const req = require('../../utils/request.js');
  111. const util = require('../../utils/util.js');
  112. const app = getApp();
  113. import mpHtml from "../../components/mp-html/components/mp-html/mp-html";
  114. export default {
  115. components: {
  116. mpHtml,
  117. },
  118. data() {
  119. return {
  120. isShow: false,
  121. options: {},
  122. detail: {},
  123. isLogin: false,
  124. userinfovip: {},
  125. isIos: false,
  126. priceIndex: 0,
  127. priceList: [],
  128. popShow: false,
  129. priceId: '',
  130. price: 0,
  131. hideShare: true,
  132. codeUrl: '',
  133. isShowUpdate: false, //是否显示更新信息弹窗
  134. isUpdateInfo: false,//更新用户信息
  135. isUpdateMobile: false,//绑定手机号
  136. enterTime : '',//进入页面时间
  137. outTime : '',//页面卸载时间
  138. stayTime : 0//页面停留时间
  139. };
  140. },
  141. async onLoad(options) {
  142. this.options = options;
  143. },
  144. async onShow() {
  145. await this.getConfig();
  146. await this.getData(true);
  147. },
  148. onReachBottom: function() {
  149. },
  150. methods: {
  151. getConfig() {
  152. var _this = this;
  153. return new Promise((resolve, reject) => {
  154. req.getRequest('/api/other/config', {}, function(res) {
  155. _this.about = res;
  156. _this.getSystem();
  157. resolve();
  158. });
  159. });
  160. },
  161. getSystem(){
  162. if(uni.getSystemInfoSync().platform == 'ios'){
  163. if(this.about.is_open_iosPay == 1){
  164. this.isIos = false;
  165. }else{
  166. this.isIos = true;
  167. }
  168. }else{
  169. this.isIos = false;
  170. }
  171. },
  172. getData(isShow){
  173. return new Promise((resolve, reject) => {
  174. req.getRequest('/api/match/detail',{id: this.options.id},async res => {
  175. this.detail = res;
  176. // 外链活动
  177. if(this.detail.type==2 && this.detail.text){
  178. let url = this.detail.text
  179. url = url + '?salesno=' + req.getStorage('userInfo').saleNo
  180. // 如果打开的分享的销售员微页
  181. // if(req.getStorage('shareId')){
  182. // url = url + '?salesno=' + req.getStorage('shareId')
  183. // }else{
  184. // // 如果自己是销售员
  185. // if(req.getStorage('userInfo').saleNo){
  186. // url = url + '?salesno=' + req.getStorage('userInfo').saleNo
  187. // }else{
  188. // //当前绑定的微页或推荐的微页
  189. // let salesno = await new Promise((r,j)=>{
  190. // req.getLocation(res => {
  191. // const to = {
  192. // latitude: res.latitude,
  193. // longitude: res.longitude
  194. // };
  195. // req.getRequest('/api/visiting/card/recommendCardInfo', to, res => {
  196. // r(res.jobNumber?res.jobNumber:'')
  197. // })
  198. // });
  199. // })
  200. // url = url + '?salesno=' + salesno
  201. // }
  202. // }
  203. uni.redirectTo({
  204. url: '/pages/web/web?url='+encodeURIComponent(url)
  205. });
  206. return false
  207. }
  208. this.isShow = true;
  209. resolve();
  210. },isShow);
  211. })
  212. },
  213. getPrice(){
  214. return new Promise((resolve, reject) => {
  215. req.getRequest('/api/match/price',{id: this.options.id},res=>{
  216. this.priceList = res;
  217. this.priceId = res[0].id;
  218. let price = 0;
  219. if(this.userinfovip.levelGrade>0&& !this.userinfovip.end){
  220. price = res[0].vipMoney;
  221. }else{
  222. price = res[0].money;
  223. }
  224. this.price = price;
  225. req.setStorage('actPrice',price)
  226. resolve();
  227. })
  228. })
  229. },
  230. getuserVip() {
  231. return new Promise((resolve,reject)=>{
  232. req.getRequest('/api/user/levelDetails', {}, data => {
  233. let expireTime = Array;
  234. if (data.expireTime) {
  235. expireTime = data.expireTime.split(" ");
  236. data.expireTime = data.expireTime.replace(/-/g, '/');
  237. } // 解决苹果不兼容---日期
  238. let nowTime = new Date().getTime();
  239. let endTime = new Date(data.expireTime).getTime();
  240. let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
  241. // console.log(times, nowTime, endTime, data.expireTime);
  242. this.userinfovip = data;
  243. if (times <= 0) {
  244. this.userinfovip.end = true;
  245. } else {
  246. this.userinfovip.end = false;
  247. }
  248. });
  249. resolve();
  250. })
  251. },
  252. formatTimeCommStr(dataStr) {
  253. return util.formatTimeCommStr(dataStr, 'M/D 00:00');
  254. },
  255. formData(validDate){
  256. let time = new Date(validDate.replace(/-/g, '/'));
  257. return util.formatTime(time).t2
  258. },
  259. formDataObj(validDate){
  260. let time = new Date(validDate.replace(/-/g, '/'));
  261. return util.formatTime(time)
  262. },
  263. formDatahd(){
  264. if(this.detail.startTime&&this.detail.endTime){}
  265. else return false
  266. return this.formDataObj(this.detail.startTime).t2==this.formDataObj(this.detail.endTime).t2?
  267. (this.formDataObj(this.detail.startTime).t2+' '+this.formDataObj(this.detail.startTime).t6+' - '+this.formDataObj(this.detail.endTime).t6)
  268. :(this.formDataObj(this.detail.startTime).t5+' - '+this.formDataObj(this.detail.endTime).t5)
  269. },
  270. getBrowse(){
  271. let params={
  272. bindId: this.options.id,
  273. type: 10
  274. }
  275. req.postRequest('/api/browse', params, data => {});
  276. },
  277. toActivity(item){
  278. uni.navigateTo({
  279. url: '/match/activityDetail/activityDetail?id=' + item.id
  280. })
  281. },
  282. choose: function () {
  283. let freshen = false;
  284. this.$emit('freshen', {
  285. detail: freshen
  286. });
  287. },
  288. // clickCollect(){
  289. // req.isLogin().then(success => {
  290. // if(success){
  291. // req.postRequest('/api/collect',{
  292. // bindId: this.detail.id,
  293. // type: 2
  294. // },res=>{
  295. // this.detail.isCollect = !this.detail.isCollect;
  296. // })
  297. // }
  298. // })
  299. // },
  300. // 用户行为
  301. userBehavior(type) {
  302. var dataP = {};
  303. dataP.type =2 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  304. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  305. dataP.bindId = this.detail.id;
  306. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  307. if (type == 2) {
  308. this.detail.isCollect = !this.detail.isCollect;
  309. if(this.detail.isCollect){
  310. req.saveBehaviorNew(this.detail.id,2,2)
  311. }else{
  312. req.saveBehaviorNew(this.detail.id,2,16)
  313. }
  314. }
  315. if (type == 3) {
  316. this.cardInfo.follow = !this.cardInfo.follow
  317. }
  318. if(type == 4) {
  319. // req.saveBehaviorNew(this.detail.id,2,4)
  320. }
  321. });
  322. },
  323. showPop(){
  324. let that = this;
  325. that.jumpUrl('/match/sign/sign?id=' + that.detail.id);
  326. },
  327. hidePop(){
  328. this.popShow = false;
  329. },
  330. selProject(it,idx){
  331. if(this.priceIndex == idx) return false;
  332. this.priceIndex = idx;
  333. this.priceId = it.id;
  334. console.log('priceId==' + this.priceId)
  335. let price = 0;
  336. if(this.userinfovip.levelGrade>0&& !this.userinfovip.end){
  337. price = it.vipMoney;
  338. }else{
  339. price = it.money;
  340. }
  341. this.price = price;
  342. req.setStorage('actPrice',price)
  343. },
  344. jumpUrl(url){
  345. req.isLogin().then(success => {
  346. if(success){
  347. uni.navigateTo({
  348. url: url
  349. })
  350. }
  351. })
  352. this.hidePop();
  353. },
  354. showShare() {
  355. // console.log(11111,this.hideShare)
  356. // #ifdef H5
  357. this.setData({
  358. hideShare: false
  359. });
  360. // #endif
  361. // #ifndef H5
  362. req.isLogin().then(success => {
  363. // console.log(success)
  364. if (success) {
  365. this.getCodeUrl()
  366. this.setData({
  367. hideShare: false
  368. });
  369. // console.log(this.hideShare)
  370. }
  371. });
  372. // #endif
  373. },
  374. getCodeUrl() {
  375. let that = this;
  376. let scene = that.detail.id;
  377. // console.log(scene); //获取小程序码
  378. const params = {
  379. page: 'match/activityDetail/activityDetail',
  380. scene: scene
  381. };
  382. req.getRequest('/api/program/codev', params, url => {
  383. that.setData({
  384. codeUrl: url
  385. });
  386. });
  387. },
  388. click(e) {
  389. // console.log(e,"7899")
  390. this.hideShare = e
  391. },
  392. loadCodeParams() {
  393. let _ts = this;
  394. return new Promise((resolve, reject) => {
  395. let form = {
  396. scene: _ts.options.scene
  397. };
  398. if (!_ts.options.scene) {
  399. resolve();
  400. return false;
  401. }
  402. req.getRequest('/api/code/params', form, data => {
  403. let res = data.scene.split('_');
  404. this.options.id = res[0];
  405. req.setStorage('pidCode', data.userId);
  406. resolve();
  407. });
  408. });
  409. },
  410. monthDayDiff(date){
  411. return util.monthDayDiff(date)
  412. },
  413. closeUpdate(){
  414. this.isShowUpdate = false
  415. },
  416. updateInfo(e){
  417. this.isUpdateInfo = e;
  418. },
  419. updateMobile(e){
  420. this.isUpdateMobile = e;
  421. },
  422. getUpdate() {
  423. console.log('getUpdate')
  424. let userInfos = req.getStorage('userInfo')
  425. // if ((!userInfos.avatar || userInfos.avatar.indexOf('thirdwx.qlogo') > -1 || !userInfos.nickName || userInfos.nickName.indexOf('用户') > -1) ) {
  426. // console.log('没有昵称')
  427. // this.isShowUpdate = true;
  428. // this.isUpdateInfo = true;
  429. // return false;
  430. // }
  431. if(!userInfos.mobile){
  432. console.log('没有手机号')
  433. this.isShowUpdate = true
  434. this.isUpdateMobile = true
  435. return false;
  436. }
  437. return true;
  438. },
  439. }
  440. };
  441. </script>
  442. <style>
  443. @import "./activityDetail.css";
  444. </style>