123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <view class="content">
- <view class="itemDetail">
- <view class="typeName clamp2" :class="{wargin:type==2,base:type==1}">
- {{actionCart.title}}
- </view>
- <view class="detail">
- {{actionCart.add_time}}
- </view>
- <view class="contentDetail detail-desc">
- <rich-text class="detail-centent" :nodes="actionCart.content"></rich-text>
- </view>
- </view>
- <view class="mapBox" v-if="type==2">
- <map :enable-zoom='false' :enable-scroll='false' @click="openMap(actionCart.latitude,actionCart.longitude)"
- class="map" :latitude="actionCart.latitude" :longitude="actionCart.longitude" :markers="[{
- latitude:actionCart.latitude,
- longitude:actionCart.longitude,
- iconPath: '../../static/image/location.png',
- heighe:35,
- width:35
- }]"></map>
- <view class="mapBottom flex">
- <view>
- <image src="../../static/icon/gpsW.png" mode="widthFix"></image>
- </view>
- <view class="clamp">
- {{actionCart.title}}
- </view>
- </view>
-
- </view>
-
- </view>
- </template>
- <script>
- import {
- share
- } from '@/api/wx';
- import {
- mapState,
- } from 'vuex';
- import {
- details,
- } from '@/api/index.js';
- export default {
- data() {
- return {
- id: '',
- type: 0,
- actionCart: {},
- };
- },
- onLoad(options) {
- const that = this;
- that.id = options.id;
- that.type = options.type;
- if(+options.type==2){
-
- const eventChannel = that.$scope.eventChannel;
-
-
- const eventChannel = that.getOpenerEventChannel();
-
-
- eventChannel.on('addPushData', function(data) {
- that.actionCart = data;
- that.actionCart.content = that.actionCart.content.replace(/\<img/gi, '<img class="rich-img"');
- })
- }
- if(+options.type==1){
- that.loadData();
- }
- if(+options.type==3){
- that.loadData();
- }
- that.share()
- },
-
- onShareAppMessage(options) {
-
- let pages = getCurrentPages();
- let currentPage = pages[pages.length - 1];
- let url = currentPage.route;
- let item = currentPage.options;
- let shareObj = {
- title: this.shareData.title,
- path: url,
- imageUrl: this.shareData.img,
- desc:this.shareData.synopsis,
- success: function(res) {
-
- if (res.errMsg == 'shareAppMessage:ok') {}
- },
- fail: function() {
-
- if (res.errMsg == 'shareAppMessage:fail cancel') {
-
- } else if (res.errMsg == 'shareAppMessage:fail') {
-
- }
- }
- };
-
- if (this.userInfo) {
- shareObj.path += '&spread=' + this.userInfo.uid;
- }
- return shareObj;
- },
-
- methods: {
- share() {
- console.log('加载分享');
- const that = this;
-
- share({}).then(({
- data
- }) => {
- console.log('分享回调', data);
- that.shareData = data.data
- });
- },
-
- openMap(lat, long) {
- uni.openLocation({
- latitude: lat,
- longitude: long,
- })
- },
- navTo(url) {
- uni.navigateTo({
- url: url
- })
- },
-
- moneyNum(value) {
- return +value;
- },
-
-
- loadData() {
- const that = this;
- details({},this.id)
- .then(({
- data
- }) => {
- this.actionCart = data;
- that.actionCart.content = that.actionCart.content.replace(/\<img/gi, '<img class="rich-img"');
- uni.setNavigationBarTitle({
- title:data.title
- })
- })
- .catch(e => {
-
- });
- }
- }
- };
- </script>
- <style lang="scss">
- /deep/ .iconenter {
- font-size: $font-base + 2rpx;
- color: #888;
- }
-
- /deep/ .con_image {
- width: 130rpx;
- height: 130rpx;
- display: inline-block;
- padding: 15rpx;
-
- image {
- width: 100%;
- height: 100%;
- }
- }
-
- /* 商品详情中限制图片大小 */
- /deep/ .rich-img {
- width: 100% !important;
- height: auto;
- }
- .detail-desc {
- background: #fff;
- /deep/ img {
- max-width: 100% !important;
- display: inline !important;
- }
- /deep/ div {
- max-width: 100% !important;
- }
- }
- page,
- .content {
- background: $page-color-base;
- height: 100%;
- }
- // .content {
- // padding-top: 30rpx;
- // }
- .base-buttom {
- position: relative;
- bottom: auto;
- right: auto;
- left: auto;
- }
- .itemDetail {
- margin-bottom: 30rpx;
- padding: 50rpx;
- padding-top: 44px;
- background-color: #FFFFFF;
- .base {
- color: $font-color-base;
- }
- .wargin {
- color: $color-red;
- }
- .typeName {
- font-size: 36rpx;
- }
- .detail {
- margin-top: 10rpx;
- font-size: 24rpx;
- color: $font-color-light;
- }
- .contentDetail {
- margin-top: 40rpx;
- font-size: 28rpx;
- color: $font-color-light;
- }
- }
- .mapBox {
- position: relative;
- .mapBottom {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- padding: 15rpx;
- font-size: 24rpx;
- ;
- color: #ffffff;
- justify-content: flex-start;
- background-color: rgba($color: #000000, $alpha: 0.75);
- image {
- width: 30rpx;
- margin-right: 10rpx;
- }
- }
- .map {
- width: 750rpx;
- height: 300rpx;
- font-size: 35rpx;
- }
- .mapTip {
- position: absolute;
- top: 0;
- left: 0;
- padding: 20rpx;
- .leftMapTip {
- margin-right: 20rpx;
- width: 44rpx;
- height: 44rpx;
- border-radius: 10rpx;
- justify-content: center;
- .topTip {
- width: 24rpx;
- }
- &.success {
- background-color: $color-green;
- }
- &.error {
- background-color: $color-red;
- }
- }
- }
- }
- </style>
|