index.vue 8.0 KB

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