noticeDetail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="content">
  3. <view class="itemDetail">
  4. <view class="typeName clamp2" :class="{wargin:type==2,base:type==1}">
  5. {{actionCart.title}}
  6. </view>
  7. <view class="detail">
  8. {{actionCart.add_time}}
  9. </view>
  10. <view class="contentDetail detail-desc">
  11. <rich-text class="detail-centent" :nodes="actionCart.content"></rich-text>
  12. </view>
  13. </view>
  14. <view class="mapBox" v-if="type==2">
  15. <map :enable-zoom='false' :enable-scroll='false' @click="openMap(actionCart.latitude,actionCart.longitude)"
  16. class="map" :latitude="actionCart.latitude" :longitude="actionCart.longitude" :markers="[{
  17. latitude:actionCart.latitude,
  18. longitude:actionCart.longitude,
  19. iconPath: '../../static/image/location.png',
  20. heighe:35,
  21. width:35
  22. }]"></map>
  23. <view class="mapBottom flex">
  24. <view>
  25. <image src="../../static/icon/gpsW.png" mode="widthFix"></image>
  26. </view>
  27. <view class="clamp">
  28. {{actionCart.title}}
  29. </view>
  30. </view>
  31. <!-- <view class="mapTip flex">
  32. <view class="leftMapTip flex" :class="{success:actionCart.xh,error:!actionCart.xh}">
  33. <image class="topTip" src="../../static/icon/mpXh.png" mode="widthFix"></image>
  34. </view>
  35. <view class="leftMapTip flex" :class="{success:actionCart.gps,error:!actionCart.gps}">
  36. <image class="topTip" src="../../static/icon/mpGps.png" mode="widthFix"></image>
  37. </view>
  38. </view> -->
  39. </view>
  40. <!-- <view class="base-buttom" v-if="type==1">
  41. </view> -->
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. share
  47. } from '@/api/wx';
  48. import {
  49. mapState,
  50. } from 'vuex';
  51. import {
  52. details,
  53. } from '@/api/index.js';
  54. export default {
  55. data() {
  56. return {
  57. id: '', //保存信息id
  58. type: 0, //2为警报1为非警报
  59. actionCart: {},
  60. };
  61. },
  62. onLoad(options) {
  63. const that = this;
  64. that.id = options.id;
  65. that.type = options.type;
  66. if(+options.type==2){
  67. // #ifdef APP-NVUE
  68. const eventChannel = that.$scope.eventChannel; // 兼容APP-NVUE
  69. // #endif
  70. // #ifndef APP-NVUE
  71. const eventChannel = that.getOpenerEventChannel();
  72. // #endif
  73. // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
  74. eventChannel.on('addPushData', function(data) {
  75. that.actionCart = data;
  76. that.actionCart.content = that.actionCart.content.replace(/\<img/gi, '<img class="rich-img"');
  77. })
  78. }
  79. if(+options.type==1){
  80. that.loadData();
  81. }
  82. if(+options.type==3){
  83. that.loadData();
  84. }
  85. that.share()
  86. },
  87. // #ifdef MP
  88. onShareAppMessage(options) {
  89. // 设置菜单中的转发按钮触发转发事件时的转发内容
  90. let pages = getCurrentPages(); //获取加载的页面
  91. let currentPage = pages[pages.length - 1]; //获取当前页面的对象
  92. let url = currentPage.route; //当前页面url
  93. let item = currentPage.options; //如果要获取url中所带的参数可以查看options
  94. let shareObj = {
  95. title: this.shareData.title, // 默认是小程序的名称(可以写slogan等)
  96. path: url, // 默认是当前页面,必须是以‘/’开头的完整路径
  97. imageUrl: this.shareData.img,
  98. desc:this.shareData.synopsis,
  99. success: function(res) {
  100. // 转发成功之后的回调
  101. if (res.errMsg == 'shareAppMessage:ok') {}
  102. },
  103. fail: function() {
  104. // 转发失败之后的回调
  105. if (res.errMsg == 'shareAppMessage:fail cancel') {
  106. // 用户取消转发
  107. } else if (res.errMsg == 'shareAppMessage:fail') {
  108. // 转发失败,其中 detail message 为详细失败信息
  109. }
  110. }
  111. };
  112. // 判断是否可以邀请
  113. if (this.userInfo) {
  114. shareObj.path += '&spread=' + this.userInfo.uid;
  115. }
  116. return shareObj;
  117. },
  118. // #endif
  119. methods: {
  120. share() {
  121. console.log('加载分享');
  122. const that = this;
  123. // 请求获取默认数据
  124. share({}).then(({
  125. data
  126. }) => {
  127. console.log('分享回调', data);
  128. that.shareData = data.data
  129. });
  130. },
  131. // 打开地图导航
  132. openMap(lat, long) {
  133. uni.openLocation({
  134. latitude: lat,
  135. longitude: long,
  136. })
  137. },
  138. navTo(url) {
  139. uni.navigateTo({
  140. url: url
  141. })
  142. },
  143. // 转换金额为数字
  144. moneyNum(value) {
  145. return +value;
  146. },
  147. // 确认收货
  148. //获取订单列表
  149. loadData() {
  150. const that = this;
  151. details({},this.id)
  152. .then(({
  153. data
  154. }) => {
  155. this.actionCart = data;
  156. that.actionCart.content = that.actionCart.content.replace(/\<img/gi, '<img class="rich-img"');
  157. uni.setNavigationBarTitle({
  158. title:data.title
  159. })
  160. })
  161. .catch(e => {
  162. });
  163. }
  164. }
  165. };
  166. </script>
  167. <style lang="scss">
  168. /deep/ .iconenter {
  169. font-size: $font-base + 2rpx;
  170. color: #888;
  171. }
  172. /deep/ .con_image {
  173. width: 130rpx;
  174. height: 130rpx;
  175. display: inline-block;
  176. padding: 15rpx;
  177. image {
  178. width: 100%;
  179. height: 100%;
  180. }
  181. }
  182. /* 商品详情中限制图片大小 */
  183. /deep/ .rich-img {
  184. width: 100% !important;
  185. height: auto;
  186. }
  187. .detail-desc {
  188. background: #fff;
  189. /deep/ img {
  190. max-width: 100% !important;
  191. display: inline !important;
  192. }
  193. /deep/ div {
  194. max-width: 100% !important;
  195. }
  196. }
  197. page,
  198. .content {
  199. background: $page-color-base;
  200. height: 100%;
  201. }
  202. // .content {
  203. // padding-top: 30rpx;
  204. // }
  205. .base-buttom {
  206. position: relative;
  207. bottom: auto;
  208. right: auto;
  209. left: auto;
  210. }
  211. .itemDetail {
  212. margin-bottom: 30rpx;
  213. padding: 50rpx;
  214. padding-top: 44px;
  215. background-color: #FFFFFF;
  216. .base {
  217. color: $font-color-base;
  218. }
  219. .wargin {
  220. color: $color-red;
  221. }
  222. .typeName {
  223. font-size: 36rpx;
  224. }
  225. .detail {
  226. margin-top: 10rpx;
  227. font-size: 24rpx;
  228. color: $font-color-light;
  229. }
  230. .contentDetail {
  231. margin-top: 40rpx;
  232. font-size: 28rpx;
  233. color: $font-color-light;
  234. }
  235. }
  236. .mapBox {
  237. position: relative;
  238. .mapBottom {
  239. position: absolute;
  240. bottom: 0;
  241. left: 0;
  242. right: 0;
  243. padding: 15rpx;
  244. font-size: 24rpx;
  245. ;
  246. color: #ffffff;
  247. justify-content: flex-start;
  248. background-color: rgba($color: #000000, $alpha: 0.75);
  249. image {
  250. width: 30rpx;
  251. margin-right: 10rpx;
  252. }
  253. }
  254. .map {
  255. width: 750rpx;
  256. height: 300rpx;
  257. font-size: 35rpx;
  258. }
  259. .mapTip {
  260. position: absolute;
  261. top: 0;
  262. left: 0;
  263. padding: 20rpx;
  264. .leftMapTip {
  265. margin-right: 20rpx;
  266. width: 44rpx;
  267. height: 44rpx;
  268. border-radius: 10rpx;
  269. justify-content: center;
  270. .topTip {
  271. width: 24rpx;
  272. }
  273. &.success {
  274. background-color: $color-green;
  275. }
  276. &.error {
  277. background-color: $color-red;
  278. }
  279. }
  280. }
  281. }
  282. </style>