liveDetail.nvue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="container" :style="'height: '+windowHeight+'px;'">
  3. <jhlive ref="jhlive" class="jhlive" :sdkAppID="sdkAppID" :secretKey="secretKey" :userId="userId" :roomId="roomId"
  4. :isAuthor="isAuthor" :linkMic="linkMic" :avatar="avatar" :num="num" :likes="likes" :name="name" />
  5. <jhimlive ref="jhimlive" class="jhimlive" :sdkAppID="sdkAppID" :secretKey="secretKey" :userId="userId" :roomId="roomId"
  6. :isAuthor="isAuthor" :avatar="avatar" :name="name" @onMemberCount="num=$event" />
  7. <view class="popup-open" @click="openPop()">
  8. <!-- #ifdef APP-PLUS -->
  9. <text class="nvue-iconfont" :style="{fontFamily:'nvueIconfont'}">&#xe63f;</text>
  10. <!-- #endif -->
  11. <!-- #ifdef MP-WEIXIN -->
  12. <text class="iconfont iconzhibo-shangpin"></text>
  13. <!-- #endif -->
  14. </view>
  15. <uni-popup ref="popup" animation type="bottom" >
  16. <view class="popup-box">
  17. <view @click="closePop()" class="popup-close">
  18. <text class="popup-close-text">收起</text>
  19. </view>
  20. <scroll-view scroll-y="true" class="good-box">
  21. <view class="goods-row" v-for="(item, index) in goodsList" :key="index" @click="goToGoodDetails(item)">
  22. <view class="goods-img-box">
  23. <image class="goods-img" :src="item.imgPath" mode="aspectFill"></image>
  24. </view>
  25. <view class="goods-info">
  26. <view>
  27. <text class="goods-name">{{item.productName}}</text>
  28. </view>
  29. <text class="goods-sales">{{item.sellCount}}人付款</text>
  30. <text class="price">原价:{{item.originalPrice}}</text>
  31. <view class="goods-number-bottom">
  32. <view class="goods-number">
  33. <!-- <text class="goods-number-left">惊爆价:</text> -->
  34. <text class="goods-icon">¥</text>
  35. <text class="goods-spec">{{item.bizPrice}}</text>
  36. </view>
  37. <view class="more-button">
  38. <!-- #ifdef APP-PLUS -->
  39. <text class="nvue-iconfont more-button-iconfont" :style="{fontFamily:'nvueIconfont'}">&#xe623;</text>
  40. <!-- #endif -->
  41. <!-- #ifdef MP-WEIXIN -->
  42. <text class="iconfont more-button-iconfont"></text>
  43. <!-- #endif -->
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </scroll-view>
  49. </view>
  50. </uni-popup>
  51. </view>
  52. </template>
  53. <script>
  54. import jhlive from "@/jhlive/jhlive";
  55. import jhimlive from "@/jhim/jhimlive";
  56. const NET = require('@/utils/request')
  57. const API = require('@/config/api')
  58. export default {
  59. components: {
  60. jhlive,
  61. jhimlive
  62. },
  63. data() {
  64. return {
  65. isAuthor: false,
  66. linkMic: false,
  67. sdkAppID: API.sdkAppID,
  68. secretKey: API.secretKey,
  69. windowWidth: 0,
  70. windowHeight: 0,
  71. userId: '',
  72. roomId: '',
  73. liveId: '',
  74. num: 0,
  75. likes: 0,
  76. name: "",
  77. avatar: "../static/images/loginLogo.png",
  78. userData: {},
  79. enabledIM: false,
  80. imReady: false,
  81. imMsgs: [],
  82. videoUrl: '',
  83. goodsList: [],
  84. }
  85. },
  86. beforeCreate() {
  87. uni.showToast({
  88. title: '222',
  89. duration: 2000
  90. })
  91. const domModule = uni.requireNativePlugin('dom')
  92. console.log(111111111111111111,domModule)
  93. domModule.addRule('fontFace', {
  94. 'fontFamily': "nvueIconfont",
  95. 'src': "url('https://at.alicdn.com/t/font_2119167_43jbldmjpr3.ttf')"
  96. });
  97. console.log(222222222222222)
  98. },
  99. onLoad(options) {
  100. this.roomId = options.roomId;
  101. this.liveId = options.liveId
  102. this.userData = uni.getStorageSync("userData");
  103. this.userId = this.userData.userId;
  104. let info = uni.getSystemInfoSync();
  105. this.windowWidth = info.windowWidth;
  106. this.windowHeight = info.windowHeight;
  107. this.videoUrl = uni.getStorageSync("videoUrl").replace("http://","https://")
  108. NET.request(API.getLiveGoodsDetail + options.liveId, {}, 'GET').then(res => {
  109. this.goodsList = res.data
  110. }).catch(res => {
  111. this.$refs.uTips.show({
  112. title: '获取商品列表失败',
  113. type: 'warning',
  114. })
  115. })
  116. },
  117. onReady() {
  118. this.isAuthor = false;
  119. // this.linkMic = true;
  120. // this.userId = "123";
  121. // this.name = 'test';
  122. // this.roomId = '1';
  123. this.$nextTick(() => this.enterRoom());
  124. return;
  125. this.init();
  126. },
  127. onUnload() {
  128. this.exitRoom();
  129. },
  130. methods: {
  131. init() {
  132. this.avatar = uni.getStorageSync("liveImgUrl");
  133. this.name = uni.getStorageSync("liveName");
  134. this.$nextTick(() => this.enterRoom());
  135. },
  136. enterRoom() {
  137. this.$refs.jhimlive && this.$refs.jhimlive.enterRoom();
  138. this.$refs.jhlive && this.$refs.jhlive.enterRoom();
  139. },
  140. exitRoom() {
  141. this.$refs.jhimlive && this.$refs.jhimlive.exitRoom();
  142. this.$refs.jhlive && this.$refs.jhlive.exitRoom();
  143. },
  144. handleShop(msg) {},
  145. openPop() {
  146. this.$refs.popup.open()
  147. },
  148. closePop() {
  149. this.$refs.popup.close()
  150. },
  151. goToGoodDetails(item) {
  152. uni.navigateTo({
  153. url: '/pagesGood/goodDetails?goodId=' + item.productId
  154. });
  155. },
  156. },
  157. }
  158. </script>
  159. <style>
  160. .nvue-iconfont {
  161. font-family: "nvueIconfont";
  162. font-size: 16px;
  163. font-style: normal;
  164. -webkit-font-smoothing: antialiased;
  165. -moz-osx-font-smoothing: grayscale;
  166. }
  167. </style>
  168. <style lang="less" scoped>
  169. .container {
  170. position: relative;
  171. display: flex;
  172. flex-direction: column;
  173. align-items: stretch;
  174. width: 750rpx;
  175. }
  176. .jhlive {
  177. width: 750rpx;
  178. flex: 1;
  179. }
  180. .jhimlive {
  181. width: 400rpx;
  182. position: absolute;
  183. bottom: 10px;
  184. left: 10px;
  185. }
  186. .popup-open {
  187. width: 50px;
  188. height: 50px;
  189. position: fixed;
  190. bottom: 15px;
  191. right: 15px;
  192. background-color: #52A63A;
  193. border-radius: 50%;
  194. text-align: center;
  195. line-height: 50px;
  196. }
  197. .iconzhibo-shangpin {
  198. color: #FFFFFF;
  199. font-size: 34px;
  200. }
  201. .popup-box {
  202. background-color: #FFFFFF;
  203. width: 750rpx;
  204. height: 265px;
  205. // border-radius: 10px 10px 0 0;
  206. border-top-left-radius:10px;
  207. border-top-right-radius: 10px;
  208. }
  209. .popup-close {
  210. padding: 10px;
  211. line-height: 16px;
  212. }
  213. .popup-close-text{
  214. color: #52A63A;
  215. font-size: 15px;
  216. font-family: PingFang SC;
  217. }
  218. .good-box {
  219. width: 750rpx;
  220. height: 230px;
  221. padding: 0 0 10px 0;
  222. overflow: visible;
  223. }
  224. .goods-row:first-child {
  225. margin-top: 12px;
  226. }
  227. .goods-row {
  228. width: 700rpx;
  229. height: 104px;
  230. display: flex;
  231. flex-direction: row;
  232. flex-wrap: nowrap;
  233. background-color: #FFFFFF;
  234. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.1);
  235. border-radius: 5px;
  236. margin: 0 15px 10px 15px;
  237. }
  238. .goods-img-box {
  239. margin-right: 15px;
  240. }
  241. .goods-img {
  242. width: 104px;
  243. height: 104px;
  244. object-fit: cover;
  245. }
  246. .goods-info {
  247. flex: 1;
  248. padding-top: 10px;
  249. }
  250. .goods-name {
  251. line-height: 15px;
  252. overflow: hidden;
  253. display: -webkit-box;
  254. -webkit-line-clamp: 2;
  255. -webkit-box-orient: vertical;
  256. word-wrap: break-word;
  257. text-overflow: ellipsis;
  258. font-size: 15px;
  259. font-family: PingFang SC;
  260. color: #333333;
  261. }
  262. .goods-sales {
  263. font-size: 12px;
  264. font-family: PingFang SC;
  265. color: #666666;
  266. line-height: 15px;
  267. margin: 8px 0 8px 0;
  268. }
  269. .price {
  270. font-size: 12px;
  271. text-decoration: line-through;
  272. color: #A67954;
  273. }
  274. .goods-number-bottom {
  275. display: flex;
  276. flex-direction: row;
  277. }
  278. .goods-number {
  279. display: flex;
  280. flex-direction: row;
  281. white-space: nowrap;
  282. line-height: 24px;
  283. }
  284. .goods-number-left {
  285. font-size: 12px;
  286. color: #666666;
  287. }
  288. .goods-icon {
  289. font-size: 14px;
  290. font-family: PingFang SC;
  291. color: #52A63A;
  292. }
  293. .goods-spec {
  294. font-size: 24px;
  295. font-family: PingFang SC;
  296. color: #52A63A;
  297. }
  298. .more-button {
  299. width: 24px;
  300. height: 24px;
  301. position: absolute;
  302. right: 16px;
  303. }
  304. .more-button-iconfont {
  305. font-size: 36px;
  306. color: #999999;
  307. }
  308. </style>