liveDetail.nvue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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" :subtitle="num" :likes="likes" :title="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 iconzhibo-shangpin" :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 class="popup-close">
  18. <text class="popup-close-text" @click="closePop()">收起</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 icongengduo"></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. goodsIds:[]
  85. }
  86. },
  87. beforeCreate() {
  88. uni.showToast({
  89. title: '222',
  90. duration: 2000
  91. })
  92. const domModule = uni.requireNativePlugin('dom')
  93. console.log(111111111111111111, domModule)
  94. domModule.addRule('fontFace', {
  95. 'fontFamily': "nvueIconfont",
  96. 'src': "url('https://at.alicdn.com/t/font_2119167_43jbldmjpr3.ttf')"
  97. });
  98. console.log(222222222222222)
  99. },
  100. onLoad(options) {
  101. this.roomId = options.roomId;
  102. this.liveId = options.liveId
  103. this.userData = uni.getStorageSync("userData");
  104. this.userId = this.userData.userId;
  105. let info = uni.getSystemInfoSync();
  106. this.windowWidth = info.windowWidth;
  107. this.windowHeight = info.windowHeight;
  108. this.videoUrl = uni.getStorageSync("videoUrl").replace("http://", "https://")
  109. NET.request(API.getLiveGoodsDetail + options.liveId, {}, 'GET').then(res => {
  110. this.goodsList = res.data
  111. }).catch(res => {
  112. this.$refs.uTips.show({
  113. title: '获取商品列表失败',
  114. type: 'warning',
  115. })
  116. })
  117. },
  118. onReady() {
  119. this.isAuthor = false;
  120. this.linkMic = true;
  121. this.userId = "123";
  122. this.name = 'test';
  123. this.roomId = '1';
  124. this.$nextTick(() => this.enterRoom());
  125. return;
  126. this.init();
  127. },
  128. onUnload() {
  129. this.exitRoom();
  130. },
  131. methods: {
  132. init() {
  133. this.avatar = uni.getStorageSync("liveImgUrl");
  134. this.name = uni.getStorageSync("liveName");
  135. this.$nextTick(() => this.enterRoom());
  136. },
  137. enterRoom() {
  138. this.$refs.jhimlive && this.$refs.jhimlive.enterRoom();
  139. this.$refs.jhlive && this.$refs.jhlive.enterRoom();
  140. },
  141. exitRoom() {
  142. this.$refs.jhimlive && this.$refs.jhimlive.exitRoom();
  143. this.$refs.jhlive && this.$refs.jhlive.exitRoom();
  144. },
  145. handleShop(msg) {},
  146. openPop() {
  147. this.$refs.popup.open()
  148. },
  149. closePop() {
  150. this.$refs.popup.close()
  151. },
  152. goToGoodDetails(item) {
  153. uni.navigateTo({
  154. url: '/pagesGood/goodDetails?goodId=' + item.productId
  155. });
  156. }
  157. },
  158. }
  159. </script>
  160. <style>
  161. .nvue-iconfont {
  162. font-family: "nvueIconfont";
  163. font-size: 16px;
  164. font-style: normal;
  165. -webkit-font-smoothing: antialiased;
  166. -moz-osx-font-smoothing: grayscale;
  167. }
  168. </style>
  169. <style lang="less" scoped>
  170. .container {
  171. position: relative;
  172. display: flex;
  173. flex-direction: column;
  174. align-items: stretch;
  175. width: 750rpx;
  176. }
  177. .jhlive {
  178. width: 750rpx;
  179. flex: 1;
  180. }
  181. .jhimlive {
  182. width: 400rpx;
  183. position: absolute;
  184. bottom: 10px;
  185. left: 10px;
  186. }
  187. .popup-open {
  188. width: 50px;
  189. height: 50px;
  190. position: fixed;
  191. bottom: 15px;
  192. right: 15px;
  193. background-color: #52A63A;
  194. border-radius: 50%;
  195. text-align: center;
  196. line-height: 50px;
  197. }
  198. .iconzhibo-shangpin {
  199. color: #FFFFFF;
  200. font-size: 34px;
  201. text-align: center;
  202. line-height: 50px;
  203. }
  204. .popup-box {
  205. background-color: #FFFFFF;
  206. width: 750rpx;
  207. height: 265px;
  208. border-top-left-radius: 10px;
  209. border-top-right-radius: 10px;
  210. }
  211. .popup-close {
  212. padding: 10px;
  213. line-height: 16px;
  214. }
  215. .popup-close-text {
  216. color: #52A63A;
  217. font-size: 15px;
  218. font-family: PingFang SC;
  219. text-align: left;
  220. }
  221. .good-box {
  222. width: 750rpx;
  223. height: 230px;
  224. padding: 0 0 10px 0;
  225. overflow: visible;
  226. }
  227. .goods-row:first-child {
  228. margin-top: 12px;
  229. }
  230. .goods-row {
  231. width: 700rpx;
  232. height: 104px;
  233. display: flex;
  234. flex-direction: row;
  235. flex-wrap: nowrap;
  236. background-color: #FFFFFF;
  237. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.1);
  238. border-radius: 5px;
  239. margin: 0 15px 10px 15px;
  240. }
  241. .goods-img-box {
  242. margin-right: 15px;
  243. }
  244. .goods-img {
  245. width: 104px;
  246. height: 104px;
  247. object-fit: cover;
  248. }
  249. .goods-info {
  250. flex: 1;
  251. padding-top: 10px;
  252. }
  253. .goods-name {
  254. line-height: 15px;
  255. overflow: hidden;
  256. display: -webkit-box;
  257. -webkit-line-clamp: 2;
  258. -webkit-box-orient: vertical;
  259. word-wrap: break-word;
  260. text-overflow: ellipsis;
  261. font-size: 15px;
  262. font-family: PingFang SC;
  263. color: #333333;
  264. }
  265. .goods-sales {
  266. font-size: 12px;
  267. font-family: PingFang SC;
  268. color: #666666;
  269. line-height: 15px;
  270. margin: 8px 0 8px 0;
  271. }
  272. .price {
  273. font-size: 12px;
  274. text-decoration: line-through;
  275. color: #A67954;
  276. }
  277. .goods-number-bottom {
  278. display: flex;
  279. flex-direction: row;
  280. }
  281. .goods-number {
  282. display: flex;
  283. flex-direction: row;
  284. white-space: nowrap;
  285. line-height: 24px;
  286. }
  287. .goods-number-left {
  288. font-size: 12px;
  289. color: #666666;
  290. }
  291. .goods-icon {
  292. font-size: 14px;
  293. font-family: PingFang SC;
  294. color: #52A63A;
  295. }
  296. .goods-spec {
  297. font-size: 24px;
  298. font-family: PingFang SC;
  299. color: #52A63A;
  300. }
  301. .more-button {
  302. width: 24px;
  303. height: 24px;
  304. position: absolute;
  305. right: 16px;
  306. }
  307. .more-button-iconfont {
  308. font-size: 36px;
  309. color: #999999;
  310. text-align: center;
  311. }
  312. </style>