index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <view class="content">
  3. <!-- <image class="logo" :src="detailObj.picture" mode='aspectFill'></image> -->
  4. <view class="page-section-spacing" style="width: 100%;">
  5. <swiper class="swiper"
  6. indicator-dots="true"
  7. duration="1500" >
  8. <swiper-item>
  9. <video :src="detailObj.video" id="myVideo" controls='true' ></video>
  10. </swiper-item>
  11. <swiper-item v-for="(item , index) in detailObj.picture" :key="index">
  12. <image :src="item" mode="aspectFill" style="width: 100%;height: 100%;"></image>
  13. </swiper-item>
  14. </swiper>
  15. </view>
  16. <view class="detail-title" @longpress="copyTitle">
  17. <text class="detail-font">{{detailObj.desc || '-'}}</text>
  18. <text class="price-style">¥{{detailObj.money || '-'}}</text>
  19. <!-- <button type="default" class="copy-title-btn" @click="copyTitle">复制标题</button> -->
  20. </view>
  21. <view class="share-box">
  22. <u-parse :content="shareContent"></u-parse>
  23. <button type="default" @click.stop='showShareModal'>分享</button>
  24. </view>
  25. <!-- <view class="share-box" style="height: 200upx;margin-top: 2%;" @longpress="copyCode">
  26. <view>长按复制框内整段文字,打开 [手淘] 即可购买</view>
  27. <view style="text-align: center;">{{shareCode}}</view>
  28. <view style="text-align: center;">复制店铺名[{{shareCode || '-'}}],打开[Tao宝]</view>
  29. <view style="text-align: center;">搜索进入</view>
  30. <button type="default" @click="copyCode">一键复制</button>
  31. </view> -->
  32. <view class="share-box-new" @longpress="copyCode">
  33. <view class="left-box">
  34. <image :src="storeImg" mode="aspectFill"></image>
  35. <view>{{shareCode || '-'}}</view>
  36. </view>
  37. <!-- <view style="margin-right: 3%;">
  38. <button type="default" class="copy-content-btn" @click="copyCode">一键复制</button>
  39. </view> -->
  40. </view>
  41. <view class="product-title">产品详情</view>
  42. <view class="rich-text-box" style="padding: 10px;">
  43. <u-parse :content="detailObj.content"></u-parse>
  44. </view>
  45. <!-- <image class="logo-footer" src="/static/detail-bg2.png"></image> -->
  46. <uni-popup ref="popup" type="bottom">
  47. <view class="uni-share">
  48. <view class="uni-share-content">
  49. <button class="uni-share-content-box" open-type="share">
  50. <view class="uni-share-content-image"><image src="/static/userSetIcon.png" class="image" /></view>
  51. <view class="uni-share-content-text">分享给好友</view>
  52. </button>
  53. <button class="uni-share-content-box" @click="goPostShare">
  54. <view class="uni-share-content-image"><image src="/static/share-icon1.png" class="image" /></view>
  55. <view class="uni-share-content-text">海报分享</view>
  56. </button>
  57. <button class="uni-share-content-box" @click="goRuleList">
  58. <view class="uni-share-content-image"><image src="/static/note.png" class="image" /></view>
  59. <view class="uni-share-content-text">分享规则</view>
  60. </button>
  61. </view>
  62. <view class="uni-share-btn" @click="cancelModal()">取消</view>
  63. </view>
  64. </uni-popup>
  65. </view>
  66. </template>
  67. <script>
  68. var md5 = require("../../../common/md5.js");
  69. import uParse from '@/components/gaoyia-parse/parse.vue'
  70. import uniPopup from "@/components/uni-popup/uni-popup.vue";
  71. export default {
  72. components: {
  73. uParse,
  74. uniPopup
  75. },
  76. data() {
  77. return {
  78. title: 'Hello',
  79. homeSlide: [
  80. {
  81. img:'https://f.xazhima.com/userfiles/upload/indexpic/202005251006524535.jpg'
  82. },
  83. {
  84. img:'https://f.xazhima.com/userfiles/upload/indexpic/202005251007104506.jpg'
  85. },
  86. ], // 定义值接收轮播图数据
  87. detailObj:{},
  88. shareContent:'',
  89. shareCode:'',
  90. storeImg:'',
  91. isAuthPhone:getApp().globalData.user_phone,
  92. }
  93. },
  94. onLoad(option) {
  95. this.getDetailInfo(option.detailId);
  96. },
  97. onShow() {
  98. },
  99. onShareAppMessage() {
  100. return {
  101. title: '分销小助手',
  102. path:'/pages/index/index?scene=' + getApp().globalData.user_id
  103. }
  104. },
  105. methods: {
  106. getDetailInfo(dId){
  107. uni.showLoading({
  108. title: '加载中',
  109. });
  110. let that = this;
  111. uni.request({
  112. url: getApp().globalData.shareUrl, //需要设置为全局
  113. method: 'POST',
  114. header: {
  115. 'content-type': 'application/x-www-form-urlencoded'
  116. },
  117. data: {
  118. method: 'getProductsInfo',
  119. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  120. id: dId,
  121. sign: md5('getProductsInfo' + getApp().globalData.globalTimestamp)
  122. },
  123. success: res => {
  124. if (res.data.code === 200) {
  125. uni.hideLoading();
  126. that.detailObj = res.data.msg;
  127. that.shareContent = getApp().globalData.shareContent;
  128. that.shareCode = getApp().globalData.shareTaobaoCode;
  129. that.storeImg = getApp().globalData.shareStoreImg;
  130. console.log(that.shareContent)
  131. }
  132. }
  133. });
  134. },
  135. showShareModal(){
  136. if(this.isAuthPhone){
  137. this.$refs.popup.open();
  138. }else {
  139. uni.navigateTo({
  140. url: '../../auth/index',
  141. success: res => {},
  142. fail: () => {},
  143. complete: () => {}
  144. });
  145. }
  146. },
  147. cancelModal(){
  148. // 需要在 popup 组件,指定 ref 为 popup
  149. this.$refs.popup.close();
  150. },
  151. goPostShare() {
  152. this.$refs.popup.close()
  153. uni.navigateTo({
  154. url: '/pages/index/postShare/index'
  155. })
  156. },
  157. goRuleList(){
  158. uni.navigateTo({
  159. url: '/pages/index/ruleList/index',
  160. success: res => {},
  161. fail: () => {},
  162. complete: () => {}
  163. });
  164. },
  165. copyCode(){
  166. let that = this;
  167. uni.setClipboardData({
  168. data:that.shareCode,
  169. success() {
  170. uni.showToast({
  171. icon:'none',
  172. title:'复制成功'
  173. })
  174. }
  175. })
  176. },
  177. copyTitle(){
  178. let that = this;
  179. uni.setClipboardData({
  180. data:that.detailObj.desc,
  181. success() {
  182. uni.showToast({
  183. icon:'none',
  184. title:'复制成功'
  185. })
  186. }
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style>
  193. @import url("../../../components/gaoyia-parse/parse.css");
  194. .content {
  195. display: flex;
  196. flex-direction: column;
  197. align-items: center;
  198. justify-content: center;
  199. }
  200. .logo {
  201. height: 200px;
  202. width: 100%;
  203. }
  204. .logo-footer {
  205. height: 500px;
  206. width: 100%;
  207. }
  208. .detail-title {
  209. padding: 5px;
  210. margin-bottom: 2%;
  211. width: 100%;
  212. height: 160rpx;
  213. display: flex;
  214. flex-direction: column;
  215. justify-content: space-around;
  216. /* align-items: center; */
  217. background: #fff;
  218. font-size: 30rpx;
  219. position: relative;
  220. }
  221. .detail-font {
  222. display: -webkit-box;
  223. overflow: hidden;
  224. text-overflow: ellipsis;
  225. word-wrap: break-word;
  226. white-space: normal !important;
  227. -webkit-line-clamp: 3;
  228. -webkit-box-orient: vertical;
  229. font-size: 14px;
  230. margin-left: 5%;
  231. }
  232. .price-style {
  233. /* margin-right: 75%; */
  234. margin-left: 4.5%;
  235. color: red;
  236. }
  237. .share-box-new {
  238. display: flex;
  239. justify-content: space-between;
  240. align-items: center;
  241. width: 100%;
  242. height: 100upx;
  243. background: #fff;
  244. font-size: 28rpx;
  245. padding: 5px;
  246. margin-top: 2%;
  247. }
  248. .left-box {
  249. margin-left: 3%;
  250. display: flex;
  251. align-items: center;
  252. width: 70%;
  253. }
  254. .share-box-new image {
  255. width: 80upx;
  256. height:80upx;
  257. border-radius: 50%;
  258. margin-right: 1%;
  259. }
  260. .share-box {
  261. display: flex;
  262. flex-direction: column;
  263. justify-content: center;
  264. align-items: center;
  265. width: 80%;
  266. min-height: 300upx;
  267. border: 1px dashed red;
  268. background: #fff;
  269. font-size: 28rpx;
  270. padding: 5px;
  271. }
  272. .share-box button {
  273. width: 300rpx;
  274. height: 70rpx;
  275. line-height: 70rpx;
  276. margin-top: 2%;
  277. background-color: #27BCEF;
  278. color: #fff;
  279. }
  280. .copy-title-btn{
  281. position: absolute;
  282. width: 180rpx;
  283. height: 70rpx;
  284. line-height: 70rpx;
  285. background-color: #27BCEF!important;
  286. color: #fff!important;
  287. font-size: 28rpx;
  288. right: 10px;
  289. top: 45px;
  290. }
  291. .copy-content-btn {
  292. width: 140rpx;
  293. height: 50rpx;
  294. line-height: 50rpx;
  295. background-color: #27BCEF!important;
  296. color: #fff!important;
  297. font-size: 26rpx;
  298. padding-left: 1%;
  299. padding-right: 1%;
  300. }
  301. .title {
  302. font-size: 36upx;
  303. color: #8f8f94;
  304. }
  305. .product-title {
  306. margin-top: 2%;
  307. margin-bottom: 2%;
  308. font-size: 32rpx;
  309. }
  310. .rich-text-box {
  311. font-size: 30rpx;
  312. background: #fff;
  313. display: flex;
  314. flex-direction: column;
  315. align-items: center;
  316. }
  317. /* //分享模态框 */
  318. .uni-share-content {
  319. display: flex;
  320. flex-wrap: wrap;
  321. padding: 15px;
  322. /* justify-content: center */
  323. }
  324. .uni-share-content-box {
  325. display: flex;
  326. flex-direction: column;
  327. align-items: center;
  328. width: 25%;
  329. box-sizing: border-box;
  330. margin-left: 0;
  331. margin-right: 0;
  332. border: none;
  333. background: transparent;
  334. padding-left: 0;
  335. padding-right: 0;
  336. }
  337. .uni-share-content-box::after{
  338. border: none;
  339. }
  340. .uni-share-content-image {
  341. display: flex;
  342. justify-content: center;
  343. align-items: center;
  344. width: 60upx;
  345. height: 60upx;
  346. overflow: hidden;
  347. border-radius: 10upx;
  348. }
  349. .uni-share-content-image .image {
  350. width: 100%;
  351. height: 100%;
  352. }
  353. .uni-share-content-text {
  354. font-size: 26upx;
  355. color: #999;
  356. padding-top: 5px;
  357. // padding-bottom: 10px;
  358. }
  359. .uni-share-btn {
  360. height: 90upx;
  361. line-height: 90upx;
  362. border-top: 1px #f5f5f5 solid;
  363. text-align: center;
  364. color: #666;
  365. font-size: 30rpx;
  366. }
  367. .swiper{
  368. height: 400upx;
  369. }
  370. .swiper-item image{
  371. width: 100%;
  372. height: 400upx;
  373. }
  374. #myVideo {
  375. width: 100%;
  376. height: 400rpx;
  377. /* height: 360rpx;
  378. margin-bottom: 20rpx;
  379. border-radius: 10rpx; */
  380. }
  381. </style>