123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- id: 0,
- info: {},
- is_scan: 0,
- modalName: '',
- comment: '',
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let id = options.id;
- let is_scan = 0;
- if (options.is_scan) {
- is_scan = options.is_scan;
- }
- this.setData({id:id,is_scan:is_scan});
-
- this.getInfo();
- },
- //获取详情
- getInfo() {
- let self = this;
- app.post('business/business/detail',{id:self.data.id},function(res){
- if (res.talent_discount) {
- res.talent_discount = res.talent_discount.replace(/\<img/gi, '<img style="max-width:100%;display:block;" ');
- }
- if (res.content) {
- res.content = res.content.replace(/\<img/gi, '<img style="max-width:100%;display:block;" ');
- }
- self.setData({info:res});
- });
- },
- //导航
- nav() {
- let info = this.data.info;
- wx.openLocation({
- latitude: info.latitude - 0, //维度
- longitude: info.longitude - 0, //经度
- name: info.title, //目的地定位名称
- scale: 15, //缩放比例
- address: info.address //导航详细地址
- })
- },
- //按钮
- join() {
- app.post('business/business/join',{status:1,business_id:this.data.id},function(res){
- if (res.code == 1001) {
- app.msg('请完善信息','/pages/my/info/info');
- } else {
- app.msg('参加成功');
- }
- });
- },
- unjoin() {
- let self = this;
- app.post('business/business/join',{status:2,business_id:this.data.id,comment:this.data.comment},function(res){
- self.setData({modalName: ''});
- if (res.code == 1001) {
- app.msg('请完善信息','/pages/my/info/info');
- } else {
- app.msg('提交成功');
- }
- });
- },
- inputComment(e) {
- this.setData({comment:e.detail.value});
- },
- showModal() {
- this.setData({modalName: 'DialogModal1'});
- },
- hideModal() {
- this.setData({modalName: ''});
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- let info = this.data.info
- return {
- title: info.title,
- path: "/pages/activity/detail/detail?id="+info.id,
- imageUrl: info.main_image,
- };
- }
- })
|