14 Commits

Author SHA1 Message Date
lxb
742952453c 1 2020-07-27 08:58:46 +08:00
7245d83dcd Merge pull request 'xbx' (#11) from xbx into master
Reviewed-on: http://git.luyuan.tk/luyuan/demingshangjia/pulls/11
2020-07-25 14:54:05 +08:00
49e80c48c0 引入融云 2020-07-25 14:53:19 +08:00
7b8ddc734c 直播选择商品 2020-07-25 08:57:32 +08:00
52bbaf55e1 直播 2020-07-24 08:57:03 +08:00
78f63eb990 1 2020-07-21 20:38:16 +08:00
7924bc0d3b Merge pull request 'xbx' (#10) from xbx into master
Reviewed-on: http://git.luyuan.tk/luyuan/demingshangjia/pulls/10
2020-07-21 19:50:54 +08:00
9838aab5f4 直播需要修改接口 2020-07-21 19:50:26 +08:00
d04146d479 完成 2020-07-21 17:03:59 +08:00
72f56fe563 选择完成 2020-07-21 15:00:39 +08:00
d2ddb26479 选择商品 2020-07-21 08:57:48 +08:00
686a1b5c56 临时 2020-07-18 10:29:00 +08:00
2aef7bed5c Merge branch 'master' of http://git.luyuan.tk/luyuan/demingshangjia into xbx 2020-07-17 09:53:18 +08:00
4bade07d14 直播的修改 2020-07-17 09:49:42 +08:00
16 changed files with 11471 additions and 75 deletions

View File

@@ -12,6 +12,15 @@ const install = (Vue, vm) => {
}, },
createLivesp({spec_name}){ createLivesp({spec_name}){
return vm.$u.post("Streaming/createLivesp",{spec_name}) return vm.$u.post("Streaming/createLivesp",{spec_name})
},
getStoreGoodsList(){
return vm.$u.post("article/getStoreGoodsList")
},
createChatRoom({chat_name,live_desc,spec,goods_id,cover_img}){
return vm.$u.post("Streaming/createChatRoom",{chat_name,live_desc,spec,goods_id,cover_img})
},
liveStreamList(){
return vm.$u.post("Streaming/liveStreamList")
} }
} }
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下 // 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下

View File

@@ -2,7 +2,14 @@
<view class="item" @click="toDetailsPage"> <view class="item" @click="toDetailsPage">
<image></image> <image></image>
<view class="goods"> <view class="goods">
<view class="status" v-if="cur==4">待处理订单</view>
<view class="goods_num">
<view class="number">
编号:1234567890123456
</view>
<view class="order" v-if="cur==4">已完成订单</view>
<view class="order" v-else>待处理订单</view>
</view>
<view class="name u-line-1">心机小黑裙连衣裙赫本风夏季爆款...</view> <view class="name u-line-1">心机小黑裙连衣裙赫本风夏季爆款...</view>
<view class="info"> <view class="info">
<view class="num">共一件商品</view> <view class="num">共一件商品</view>
@@ -50,6 +57,26 @@ export default {
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
justify-content: center; justify-content: center;
.goods_num{
display: flex;
justify-content: space-between;
width: 100%;
margin-bottom: 18rpx;
.number{
font-size:22rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
line-height:36rpx;
}
.order{
font-size:26rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(255,49,49,1);
line-height:36rpx;
}
}
.status { .status {
align-self: flex-end; align-self: flex-end;
font-size: 26rpx; font-size: 26rpx;

View File

@@ -0,0 +1,71 @@
<template>
<view class="item" @click="xuanzhongs">
<image :src="image"></image>
<view class="title u-line-1" >{{title}}</view>
<view class="info">
<text>{{price}}</text>
<text>销量{{num}}</text>
</view>
<u-checkbox class="xuanzhong" active-color="#FF7A15" :name="sid" v-model="xuanzhong" @change="xuanzhongs">
</u-checkbox>
</view>
</template>
<script>
export default {
name:"shop-item",
data(){
return {
xuanzhong:false,
}
},
props:['image','title','price','num','sid'],
methods:{
xuanzhongs(){
this.xuanzhong = !this.xuanzhong
this.$emit("xuanzhong")
}
}
}
</script>
<style lang="scss" scoped>
.item{
width: 214rpx;
// height: 297rpx;
background-color: #fff;
border-radius:10rpx 10rpx 0 0;
padding-bottom: 14rpx;
overflow: hidden;
position: relative;
>image{
width: 100%;
height: 207rpx;
}
.title{
width: 194rpx;
margin: 19rpx auto;
margin-bottom: 0;
font-size: 26rpx;
color: #333;
}
.info{
display: flex;
padding: 0 10rpx;
align-items: flex-end;
justify-content: space-between;
>text:first-child{
font-size: 26rpx;
color: #FF3131;
}
>text:last-child{
font-size: 20rpx;
color: #999;
}
}
.xuanzhong{
position: absolute;
left: 8rpx;
top: 8rpx;
}
}
</style>

View File

@@ -5,7 +5,7 @@
<view class="titles">标签</view> <view class="titles">标签</view>
<view class="form-view" @click="show_add()">+ 新建标签</view> <view class="form-view" @click="show_add()">+ 新建标签</view>
<view class="form-view" :class=" {'cur': rSelect.indexOf(item.id)!=-1} " @tap="tapInfo(item.id)" v-for="(item,index) in fileListes" <view class="form-view" :class=" {'cur': rSelect.indexOf(item.id)!=-1} " @tap="tapInfo(item.id)" v-for="(item,index) in fileListes"
:key="index">{{item.spec_name}}</view> :key="index">{{item.name}}</view>
</view> </view>
<!-- 添加标签的按钮 --> <!-- 添加标签的按钮 -->
<u-popup v-model="show" mode="center" border-radius="14" :closeable="true"> <u-popup v-model="show" mode="center" border-radius="14" :closeable="true">
@@ -15,8 +15,10 @@
<view class="u-inputes"> <view class="u-inputes">
<u-input v-model="form.name" /> <u-input v-model="form.name" />
</view> </view>
<u-button class="custom-style-button" shape="circle" size="default">确定</u-button> <u-button class="custom-style-button" shape="circle" size="default" @click="chuangjian">确定</u-button>
</u-popup> </u-popup>
<u-toast ref="uToast" />
</view> </view>
</template> </template>
@@ -50,6 +52,25 @@
} else { } else {
this.rSelect.splice(this.rSelect.indexOf(e), 1); //取消 this.rSelect.splice(this.rSelect.indexOf(e), 1); //取消
} }
this.$emit("qiehuan",this.rSelect)
},
chuangjian(){
this.$u.api.createLivesp({spec_name:this.form.name}).then((res)=>{
if(res.errCode != 0){
this.$refs.uToast.show({
title: res.message,
type: 'error'
})
}else{
this.show_add()
this.$refs.uToast.show({
title: res.message,
type: 'success'
})
this.$emit("chuangjian")
}
})
} }
} }
} }

5
package-lock.json generated
View File

@@ -6,13 +6,8 @@
"dependencies": { "dependencies": {
"uview-ui": { "uview-ui": {
"version": "1.5.2", "version": "1.5.2",
<<<<<<< HEAD
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.5.2.tgz",
"integrity": "sha512-FV9G+gZTAZKEE2m85ahIbIRiC/fdzTl+eNXDIMBoyc9b+fQWQhEtmAfu6huu7AtKuTI6gfqaYn6WGcmqYvr76w=="
=======
"resolved": "https://registry.npm.taobao.org/uview-ui/download/uview-ui-1.5.2.tgz?cache=0&sync_timestamp=1594781920423&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuview-ui%2Fdownload%2Fuview-ui-1.5.2.tgz", "resolved": "https://registry.npm.taobao.org/uview-ui/download/uview-ui-1.5.2.tgz?cache=0&sync_timestamp=1594781920423&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuview-ui%2Fdownload%2Fuview-ui-1.5.2.tgz",
"integrity": "sha1-4jDud0TIBjMJe74GU+IyvJSyAwk=" "integrity": "sha1-4jDud0TIBjMJe74GU+IyvJSyAwk="
>>>>>>> fa383397b331ec0091096becf886f978cc1277fc
} }
} }
} }

View File

@@ -195,6 +195,29 @@
} }
} }
} }
},
{
"path": "pages/release/selectshop",
"style": {
"navigationBarTitleText": "选择商品",
"app-plus": {
"titleNView": {
"backgroundColor": "#2D2D2D",
"titleColor": "#FFFFFF"
}
}
}
},
{
"path": "pages/release/zhibo",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom",
"app-plus": {
"titleNView": false,
"animationType": "slide-in-bottom"
}
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -32,12 +32,14 @@
<scroll-view scroll-y style="height: 100%;width: 100%;"> <scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="complaint"> <view class="complaint">
<view class="select-container"> <view class="select-container">
<view class="title">选择骑手</view> <view class="title">选择订单号</view>
<view class="worker" v-if="JSON.stringify(worker) != '{}'"> <view class="select" v-if="JSON.stringify(worker) != '{}'">
<view>{{ worker.company + " " + worker.name }}</view> <!-- <view>{{ worker.label + " " + worker.name }}</view>
<u-icon name="edit-pen" @click="worker={}"></u-icon> <u-icon name="edit-pen"></u-icon> -->
<view class="order_num"><text>{{ worker.label}}</text><text> {{ worker.name }}</text></view>
<image src="/static/image/home/5.png" @click="open()"></image>
</view> </view>
<view v-else class="select" @click="showSelect=true"> <view v-else class="select" @click="show = true">
<view>请选择</view> <view>请选择</view>
<image src="/static/image/home/5.png"></image> <image src="/static/image/home/5.png"></image>
</view> </view>
@@ -70,7 +72,34 @@
<image src="/static/home/1.png"></image> <image src="/static/home/1.png"></image>
<view class="text" @click="release()">发布</view> <view class="text" @click="release()">发布</view>
</view> </view>
<u-select v-model="showSelect" mode="mutil-column-auto" :list="workerList" @confirm="setWorker"></u-select> <!-- <u-select v-model="showSelect" mode="mutil-column-auto" :list="workerList" @confirm="setWorker"></u-select> -->
<u-popup v-model="show" mode="bottom" >
<view class="popup_cont" >
<view class="rider">
<text>选择骑手</text>
<image src="../../static/image/tosign/noes.png" @click="show = false"></image>
</view>
<swiper style="height: 30vh" vertical="true">
<swiper-item class="swiper-item" >
<scroll-view scroll-y class="order-list">
<view class="checkd">
<u-radio-group v-model="value" @change="radioGroupChange" class="posi">
<label v-for="(item, index) in workerList" :key="index" class="check" @confirm="setWorker">
<view class="">{{item.name}}</view>
<view class="">{{item.label}}</view>
<view class="">{{item.company}}</view>
<u-radio @change="radioChange(item)" :name="item.id":disabled="item.disabled" shape="circle" active-color="rgba(255, 120, 15, 1)" wrap ="true"></u-radio>
</label>
</u-radio-group>
</view>
</scroll-view>
</swiper-item>
</swiper>
<view class="bottom_btn" style="width: 100%;background-color: #fff;">
<view class="wash-btn" @click="confirm()">确认</view>
</view>
</view>
</u-popup>
<u-popup v-model="showComplaint" mode="center" border-radius="10"> <u-popup v-model="showComplaint" mode="center" border-radius="10">
<view class="confirm-complaint"> <view class="confirm-complaint">
<view class="text"> <view class="text">
@@ -130,34 +159,45 @@ export default {
worker: {}, worker: {},
workerList: [ workerList: [
{ {
label: '百世快递公司', label: '1826789742312345',
children: [ id:'1',
{ name:'芳芳',
label: '小米' disabled: false
}, },
{ {
label: '小亮' label: '1826789742312345',
} id:'2',
] name:'张三',
disabled: false
}, },
{ {
label: '中通快递公司', label: '1826789742312345',
children: [ id:'3',
{ name:'李四',
label: '小红' disabled: false
}
]
}, },
{ {
label: '申通快递公司', label: '1826789742312345',
children: [ id:'4',
name:'王五',
disabled: false
},
{ {
label: '小蓝' label: '1826789742312345',
} id:'5',
] name:'阿郎',
disabled: false
},
{
label: '1826789742312345',
id:'6',
name:'阿娘',
disabled: false
} }
], ],
publishstate:true publishstate:true,
value: 'orange',
show: false
} }
}, },
components: { components: {
@@ -167,25 +207,39 @@ export default {
}, },
methods: { methods: {
release(){
this.publishstate = true
},
confirm(){
this.show=false
},
open(){
this.show = true
},
// 选中某个单选框时由radio时触发
radioChange(e) {
this.worker = {
label: e.label,
name: e.name,
company:e.company
}
},
// 选中任一radio时由radio-group触发
radioGroupChange(e) {
// console.log(e);
},
publish(){ publish(){
}, },
setWorker(e) { setWorker(e) {
// console.log(e); // console.log(e);
this.worker = {
company: e[0].label,
name: e[1].label
}
},
// 发布页面跳转
release(){
// uni.navigateTo({
// url: '/pages/release/tosign'
// });
this.publishstate = true
}, },
tabsChange(index) { tabsChange(index) {
this.swiperCurrent = index; this.swiperCurrent = index;
if(this.swiperCurrent == 3){
this.worker ={}
}
}, },
animationfinish(e) { animationfinish(e) {
let current = e.detail.current; let current = e.detail.current;
@@ -224,7 +278,7 @@ export default {
} }
.swiper-item { .swiper-item {
.complaint { .complaint {
margin: 0 30rpx; margin: 0rpx 30rpx 0;
padding: 75rpx 30rpx; padding: 75rpx 30rpx;
background-color: #ffffff; background-color: #ffffff;
.select-container { .select-container {
@@ -238,7 +292,7 @@ export default {
} }
.select { .select {
padding: 18rpx 20rpx; padding: 18rpx 20rpx;
width: 490rpx; width: 470rpx;
height: 60rpx; height: 60rpx;
background: rgba(236,236,236,1); background: rgba(236,236,236,1);
border-radius: 6rpx; border-radius: 6rpx;
@@ -253,6 +307,11 @@ export default {
width: 24rpx; width: 24rpx;
height: 13rpx; height: 13rpx;
} }
.order_num{
width: 367rpx;
display: flex;
justify-content: space-between;
}
} }
.worker { .worker {
display: flex; display: flex;
@@ -379,5 +438,110 @@ export default {
height: 37rpx; height: 37rpx;
} }
} }
.popup_cont{
border-top: 1px solid RGBA(239, 236, 240, 1);
background-color: #fff;
width: 100%;
height: 562rpx;
line-height: 80rpx;
font-size:28rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(102,102,102,1);
transform: scale(1);
/* top: 0px; */
transition-duration: 0.3s;
> uni-swiper {
flex: 1;
height: 100vh;
.order-list{
height: 30vh;
padding-bottom: 140rpx;
}
}
.rider{
border-radius:20px 20px 0px 0px;
font-size:30rpx;
font-family:PingFang SC;
font-weight:500;
color:rgba(51,51,51,1);
height:88rpx;
width: 100%;
padding-left: 30rpx;
border-bottom: 1px solid rgba(236, 236, 236, 1);
>image{
width: 32rpx;
height: 32rpx;
vertical-align: middle;
float: right;
padding-top: 30rpx;
padding-right:30rpx
}
}
.store{
>view{
padding-left: 30rpx;
padding-top: 30rpx;
>image{
width:60rpx;
height:60rpx;
border-radius:50%;
vertical-align: middle;
padding-right:13rpx
}
}
font-size:28rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(51,51,51,1);
line-height: 60rpx;
}
.checkd{
>radio-group .uni-list-cell{
display: flex;
flex-wrap: nowrap;
width: 100%;
padding-bottom: 140rpx;
}
.posi{
margin-bottom: 80rpx;
.check{
display: flex;
width: 100%;
justify-content: space-around;
}
}
}
.bottom_btn{
position: fixed;
width: 100%;
height: 140rpx;
bottom: 0;
}
.wash-btn {
width: 690rpx;
height: 98rpx;
background: rgba(255,120,15,1);
border-radius: 49rpx;
position: absolute;
bottom: 40rpx;
left: 50%;
transform: translate(-50%, 0);
font-size: 36rpx;
color:rgba(255,255,255,1);
text-align: center;
line-height: 98rpx;
}
}
} }
</style> </style>

View File

@@ -69,6 +69,7 @@
}else{ }else{
uni.setStorageSync("token",res.data.token) uni.setStorageSync("token",res.data.token)
uni.setStorageSync("userinfo",res.data) uni.setStorageSync("userinfo",res.data)
uni.setStorageSync('rongyun',res.data.rongcloud_token)
this.$u.route({ this.$u.route({
url:"/pages/index/index", url:"/pages/index/index",
type:"switchTab" type:"switchTab"

View File

@@ -0,0 +1,89 @@
<template>
<view class="selectshop">
<view class="title">我的商品</view>
<u-checkbox-group>
<view class="list">
<shopItem @xuanzhong="xuanzhong" class="items" v-for="(i,j) in list" :key="j" :image="i.goods_image" :title="i.goods_name" :price="i.goods_marketprice" :num="i.goods_salenum" :sid="i.goods_id" ref="shop"></shopItem>
</view>
</u-checkbox-group>
<view class="jiaru" @click="jiaru">加入售货袋</view>
</view>
</template>
<script>
import shopItem from "../../components/release/shop-item"
export default {
name:"selectshop",
data(){
return {
list:[],
sele:[]
}
},
components:{
shopItem
},
methods:{
xuanzhong(){
// console.log(this.$refs.shop)
this.sele = []
for(let i of this.$refs.shop){
// console.log(i)
if(i.xuanzhong){
this.sele.push(i.sid)
}
}
console.log(this.sele)
},
jiaru(){
let that = this
uni.setStorageSync("gouwudai",that.sele.join(","))
this.$u.route({
type:"back",
delta:1
})
}
},
onLoad(){
this.$u.api.getStoreGoodsList().then((res)=>{
this.list = res.data.list
})
}
}
</script>
<style lang="scss" scoped>
.selectshop{
padding: 15rpx 30rpx;
padding-left: 6rpx;
background-color: #2D2D2D;
min-height: calc(100vh - 45px);
.title{
color: #FF780F;
font-size: 30rpx;
font-weight: 400;
margin-left: 26rpx;
}
.list{
display: flex;
flex-wrap: wrap;
margin-top: 35rpx;
.items{
margin-left: 24rpx;
margin-bottom: 30rpx;
}
}
.jiaru{
position: fixed;
bottom: 33rpx;
right: 30rpx;
height: 80rox;
width: 348rpx;
background-color: #999;
font-size: 36rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
}
}
</style>

View File

@@ -6,7 +6,7 @@
<view class="backes"></view> <view class="backes"></view>
<!-- z自定义导航卡 --> <!-- z自定义导航卡 -->
<u-navbar title="" class="content" :background="background" :is-back="false" :border-bottom="false"> <u-navbar title="" class="content" :background="background" :is-back="false" :border-bottom="false">
<image src="../../static/image/tosign/tosigin(4).png"></image> <!-- <image src="../../static/image/tosign/tosigin(4).png"></image> -->
<image src="../../static/image/tosign/tosigin(1).png"></image> <image src="../../static/image/tosign/tosigin(1).png"></image>
</u-navbar> </u-navbar>
@@ -19,19 +19,19 @@
<u-form-item label-position="right"> <u-form-item label-position="right">
<u-input v-model="form.text" placeholder="请填写直播简介" /> <u-input v-model="form.text" placeholder="请填写直播简介" />
</u-form-item> </u-form-item>
<view class="values"><text>{{max_two}}</text>/20</view> <view class="values"><text>{{20 - form.text.length}}</text>/20</view>
<u-form-item label-position="right"> <u-form-item label-position="right" >
<u-input v-model="form.values" placeholder="我的售货袋" /> <u-input v-model="form.values" placeholder="我的售货袋" @click="navto('selectshop')"/>
<view class="rightes">售货袋</view> <view class="rightes" @click="navto('selectshop')">售货袋</view>
</u-form-item> </u-form-item>
</u-form> </u-form>
<!-- 标签的引入 --> <!-- 标签的引入 -->
<tap_tosign :fileListes="fileListes"></tap_tosign> <tap_tosign :fileListes="fileListes" @chuangjian="chuangjian" @qiehuan="qiehuan"></tap_tosign>
<view class="titles">直播封面图</view> <view class="titles">直播封面图</view>
<u-upload :max-count="1" :show-progress="true" del-color="#ececec" upload-text="上传" del-bg-color="#fff"></u-upload> <u-upload :form-data="{'name':'article_cover'}" action='https://dmmall.sdbairui.com/storeapi/Upload/uploadFile' name="article_cover" :max-count="1" :show-progress="false" @on-change="tupian" del-color="#ececec" upload-text="上传" del-bg-color="#fff"></u-upload>
</view> </view>
<view class="button-uview"> <view class="button-uview">
<u-button>{{relerest}}</u-button> <u-button @click="kaibo">{{relerest}}</u-button>
</view> </view>
</view> </view>
</view> </view>
@@ -49,16 +49,18 @@
form: { form: {
name: '', name: '',
intro: '', intro: '',
sex: '' sex: '',
text:''
}, },
value: '', value: '',
max_two : '20', max_two : '20',
max : '优秀的标题可以卖的更好哦~', max : '',
titleMaxLength : '20', titleMaxLength : '20',
show: false, show: false,
relerest: '开始直播', relerest: '开始直播',
fileListes:[] fileListes:[],
rSelect:[],
image:""
}; };
}, },
methods: { methods: {
@@ -71,7 +73,7 @@
// console.log(e); // console.log(e);
}, },
mask_u() { mask_u() {
this.show = !this.show
}, },
// 获取验证码倒计时 // 获取验证码倒计时
getCode() { getCode() {
@@ -79,6 +81,47 @@
}, },
loading() { loading() {
},
qiehuan(a){
// console.log(a)
this.rSelect = a
},
chuangjian(){
this.init()
},
tupian(a){
console.log(JSON.parse(a.data).data)
this.image = JSON.parse(a.data).data.file_name
},
navto(url){
this.$u.route({
url:"/pages/release/" + url
})
},
kaibo(){
this.$u.api.createChatRoom({
chat_name:this.max,
live_desc:this.form.text,
spec:this.rSelect.join(","),
goods_id:uni.getStorageSync("gouwudai"),
cover_img:this.image
}).then((res)=>{
console.log(res)
this.$u.route({
url:"/pages/release/zhibo",
params:{
url:res.data.url.replace("&","*"),
id:res.data.chat_id
}
})
})
},
init(){
this.$u.api.getLiveSpec().then((res)=>{
console.log(res)
this.fileListes = res.data
})
} }
}, },
components: { components: {
@@ -92,10 +135,8 @@
} }
}, },
onLoad(){ onLoad(){
this.$u.api.getLiveSpec().then((res)=>{ this.init()
console.log(res) uni.removeStorageSync('gouwudai')
this.fileListes = res.data
})
} }
}; };
</script> </script>
@@ -198,19 +239,19 @@
} }
image:nth-child(1) { image:nth-child(1) {
width: 36rpx;
height: 35rpx;
position: absolute;
right: 110rpx;
}
image:nth-child(2) {
width: 36rpx; width: 36rpx;
height: 35rpx; height: 35rpx;
position: absolute; position: absolute;
right: 48rpx; right: 48rpx;
} }
// image:nth-child(2) {
// width: 36rpx;
// height: 35rpx;
// position: absolute;
// right: 48rpx;
// }
.labales { .labales {
border-bottom: 1px #fff solid; border-bottom: 1px #fff solid;
margin-bottom: 180rpx; margin-bottom: 180rpx;

View File

@@ -54,7 +54,6 @@
} }
}, },
components: { components: {
uniBadge
} }
} }
</script> </script>

385
pages/release/zhibo.nvue Normal file
View File

@@ -0,0 +1,385 @@
<template>
<div>
<live-pusher id='livePusher' ref="livePusher" class="livePusher" :url="url"
mode="SD" :muted="true" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2"
aspect="9:16" @statechange="statechange" @netstatus="netstatus" @error = "error"
:style="{'height':height + 'px'}"
></live-pusher>
<div class="bottom" :style="{'height':height + 'px'}" v-if="show" @click="show = false">
<div class="tanchuceng" @click="zuzhi">
<div class="head">
<div style="flex-direction: row;align-items:center">
<text class="title">全部商品</text>
<text class="num">2件</text>
</div>
<!-- <div class="add">
<text style="font-size:28rpx;color: #fff;text-align:center">添加/管理商品</text>
</div> -->
</div>
<list class="list">
<cell class="item" v-for="(i,j) in list" @click="xuanzhong(j)">
<image class="shopimg" :src="i.goods_image"></image>
<div class="info">
<div>
<text style="font-size:26rpx;colro:#333;margin-top:12rpx;lines:1;text-overflow:ellipsis">{{i.goods_name}}</text>
<text style="font-size:24rpx;color:#333;margin-top:14rpx;lines:1;text-overflow:ellipsis">{{i.goods_advword}}</text>
</div>
<div style="flex-direction: row; align-items: flex-end;">
<text style="font-size:28rpx;color:#FF3131">¥{{i.goods_price}}</text>
<text style="font-size:26rpx;color:#999">¥{{i.goods_marketprice}}</text>
</div>
</div>
<image :src="'../../static/image/release/' + (i.putaway == 1 ? 'on' : 'off') + '.png'" style="width:55rpx;height:35rpx;margin-top:120rpx;margin-left:150rpx"></image>
</cell>
</list>
</div>
</div>
<div class="user">
</div>
<div style="position: fixed;top: 60rpx;left: 30rpx;flex-direction: row;align-items:center">
<image class="userhead" :src="info.member_avatar"></image>
<div class="userinfo">
<text class="username">{{info.member_name}}</text>
<text class="username" style="font-size:20rpx">asdasdsa | sadasdas</text>
</div>
</div>
<!-- <button class="btn" @click="start">开始推流1</button>
<button class="btn" @click="pause">暂停推流</button>
<button class="btn" @click="resume">resume</button>
<button class="btn" @click="stop">停止推流</button>
<button class="btn" @click="snapshot">快照</button>
<button class="btn" @click="startPrediv">开启摄像头预览</button>
<button class="btn" @click="stopPrediv">关闭摄像头预览</button>
rtmp://107268.livepush.myqcloud.com/live/26?txSecret=826e36f52669ebf9290644b82a1d8b33&txTime=5F1A84E4
<button class="btn" @click="switchCamera">切换摄像头</button> -->
</div>
</template>
<style lang="scss" scoped>
.username{
font-size: 24rpx;
color: #fff;
lines:1;
text-overflow:ellipsis
}
.userinfo{
height: 60rpx;
margin-left: 20rpx;
justify-content: space-between;
width: 200rpx;
}
.userhead{
width: 70rpx;
height: 70rpx;
// position: fixed;
// top: 60rpx;
// left: 30rpx;
border-radius: 35rpx;
}
.user{
width: 308rpx;
height: 70rpx;
border-radius: 35rpx;
background-color: #000;
opacity:0.2;
position: fixed;
top: 60rpx;
left: 30rpx;
}
.info{
height: 160rpx;
justify-content: space-between;
margin-left: 10rpx;
width: 304rpx;
}
.shopimg{
width: 160rpx;
height: 160rpx;
background-color: #0f0;
}
.item{
width: 690rpx;
height: 200rpx;
border-bottom-width: 2rpx;
border-style: solid;
border-color: #ECECEC;
display: flex;
flex-direction: row;
align-items: center;
}
.list{
width: 750rpx;
height: 694rpx;
padding-left: 30rpx;
padding-right: 30rpx;
}
.add{
width: 221rpx;
height: 40rpx;
background-color: #FF780F;
border-radius: 20rpx;
justify-content: center;
margin-right: 30rpx;
}
.num{
font-size: 26rpx;
color: #FF3131;
margin-left: 30rpx;
}
.bottom{
width: 750rpx;
position: fixed;
top:0;
z-index: 10;
}
.head{
width: 750rpx;
height: 88rpx;
border-bottom-width: 2rpx;
border-style: solid;
border-color: #ECECEC;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.title{
font-size: 30rpx;
color:#333;
margin-left: 30rpx;
}
.tanchuceng{
width: 750rpx;
height: 782rpx;
position: fixed;
bottom: 0;
border-top-left-radius:20rpx;
border-top-left-radius:20rpx;
background-color: #fff;
transition: bottom 0.5s;
z-index: 20;
}
</style>
<script>
const RongIMLib = require('../../static/rongyun.js');
export default {
data: {
fil: true,
url:'',
height:0,
show:true,
list:[],
info:{},
im:{}
},
onReady() {
// 注意需要在onReady中 或 onLoad 延时
this.context = uni.createLivePusherContext("livePusher", this);
this.startPreview()
let that = this
uni.getSystemInfo({
success(a){
console.log(a.windowHeight)
that.height = a.windowHeight
// that.start()
}
})
},
onLoad(a){
this.url = a.url.replace("*","&")
let that = this
const token = uni.getStorageSync('token');
uni.request({
url:"https://dmmall.sdbairui.com//storeapi/Streaming/liveStreamList",
method:"POST",
headers:{
'Authorization' : 'Bearer' + " " + token
},
success(res){
console.log(res)
that.list= res.data.data
}
})
uni.request({
url:"https://dmmall.sdbairui.com/storeapi/member/memberInfo",
method:"POST",
headers:{
'Authorization' : 'Bearer' + " " + token
},
success(res){
console.log(res.data.data.memberInfo)
that.info = res.data.data.memberInfo
}
})
var config = {
appkey: 'mgb7ka1',
debug:true
};
var im = RongIMLib.init(config);
var conversationList = []; // 当前已存在的会话列表
im.watch({
conversation: function(event){
var updatedConversationList = event.updatedConversationList; // 更新的会话列表
console.log('更新会话汇总:', updatedConversationList);
console.log('最新会话列表:', im.Conversation.merge({
conversationList,
updatedConversationList
}));
},
message: function(event){
var message = event.message;
console.log('收到新消息:', message);
},
status: function(event){
var status = event.status;
console.log('连接状态码:', status);
}
});
var user = {
token: uni.getStorageSync('rongyun')
};
im.connect(user).then(function(user) {
console.log('链接成功, 链接用户 id 为: ', user.id);
}).catch(function(error) {
console.log('链接失败: ', error.code, error.msg);
});
var chatRoom = im.ChatRoom.get({
id: a.id
});
chatRoom.join({
count: 20 // 进入后, 自动拉取 20 条聊天室最新消息
}).then(function() {
console.log('加入聊天室成功');
});
},
methods: {
statechange(e) {
console.log("statechange:" + JSON.stringify(e));
},
netstatus(e) {
// console.log("netstatus:" + JSON.stringify(e));
},
error(e) {
console.log("error:" + JSON.stringify(e));
},
start: function() {
console.log(this.url)
this.context.start({
success: (a) => {
console.log("livePusher.start:" + JSON.stringify(a));
}
});
},
close: function() {
this.context.close({
success: (a) => {
console.log("livePusher.close:" + JSON.stringify(a));
}
});
},
snapshot: function() {
this.context.snapshot({
success: (e) => {
console.log(JSON.stringify(e));
}
});
},
resume: function() {
this.context.resume({
success: (a) => {
console.log(this.url + '12')
console.log("livePusher.resume:" + JSON.stringify(a));
}
});
},
pause: function() {
this.context.pause({
success: (a) => {
console.log("livePusher.pause:" + JSON.stringify(a));
}
});
},
stop: function() {
this.context.stop({
success: (a) => {
console.log(JSON.stringify(a));
}
});
},
switchCamera: function() {
this.context.switchCamera({
success: (a) => {
console.log("livePusher.switchCamera:" + JSON.stringify(a));
}
});
},
startPreview: function() {
let that = this
this.context.startPreview({
success: (a) => {
console.log("livePusher.startPreview:" + JSON.stringify(a));
that.start()
}
});
},
stopPreview: function() {
this.context.stopPreview({
success: (a) => {
console.log("livePusher.stopPreview:" + JSON.stringify(a));
}
});
},
guanbi(){
this.show = false
console.log(123)
},
zuzhi(event){
event.stopPropagation();
},
xuanzhong(i){
this.list[i].putaway = this.list[i].putaway == 0 ? 1 : 0
const token = uni.getStorageSync('token');
let arr = []
for(let i in this.list){
if(this.list[i].putaway == 1){
arr.push(this.list[i].goods_id)
}
}
let that = this
uni.request({
url:"https://dmmall.sdbairui.com/storeapi/Streaming/updateGoods",
method:"POST",
data:{
goods_id:arr.join(',')
},
headers:{
'Authorization' : 'Bearer' + " " + token
},
success(res){
console.log(res)
uni.request({
url:"https://dmmall.sdbairui.com//storeapi/Streaming/liveStreamList",
method:"POST",
headers:{
'Authorization' : 'Bearer' + " " + token
},
success(res){
console.log(res)
that.list= res.data.data
}
})
}
})
}
}
}
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
static/image/release/on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

10571
static/rongyun.js Normal file

File diff suppressed because one or more lines are too long