作者 lihongjuan

提交

要显示太多修改。

为保证性能只显示 62 of 62+ 个文件。

<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
post: function(url, data, method) {
var promise = new Promise((resolve, reject) => {
//init
let that = this,
token = uni.getStorageSync('token'),
header = {
'token': token || ''
},
postData;
//网络请求
uni.request({
url: this.globalData.baseUrl + url,
data: data,
method: method,
header: header,
success: function(res) {
//返回取得的数据
if (res.data.code == '1') {
resolve(res.data.data);
} else {
reject(res.data);
}
},
fail: function(e) {
reject('网络出错');
uni.hideNavigationBarLoading();
}
});
});
return promise;
},
globalData: {
userInfo: null,
baseUrl: 'http://knew.t.brotop.cn/api/',
},
}
</script>
<style>
/*每个页面公共css */
/* 搜索 */
.nodata{
color:#999;
font-size: 32rpx;
text-align: center;
margin-top:100rpx
}
image{
width:100%;
height: 100%;
}
.searhtoppage{
width:100%;
background: #fff;
position: fixed;
top:0;
left:0;
z-index:99
}
.searchtop{
width: 688rpx;
height: 64rpx;
background: #f2f4f8;
border-radius: 32rpx;
padding: 14rpx 32rpx;
box-sizing: border-box;
margin:0 auto
}
.searchtopk{
width: 608rpx;
height: 64rpx;
background: #f2f4f8;
border-radius: 32rpx;
padding: 14rpx 32rpx;
box-sizing: border-box;
}
.cancelname{
color:#252F3E;
font-size: 32rpx;
font-weight: bold;
}
.searchleft{
color:#9B9B9B;
font-size:28rpx;
flex:1;
text-align: left;
padding-left: 20rpx;
}
.searchleft input{
width:100%
}
.search{
width:26rpx;
height: 26rpx;
}
.register {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
}
/* 右箭头 */
.more{
color:#707070;
font-size: 24rpx;
}
.yourow{
width:14rpx;
height: 14rpx;
margin-left:20rpx;
}
.flex {
display: flex;
}
.flexone {
display: flex;
align-items: center;
}
.flextwo {
display: flex;
align-items: center;
justify-content: space-between;
}
.flexthree {
display: flex;
align-items: center;
justify-content: center;
}
.flexfour {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.flexfive {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
}
</style>
... ...
<template>
<view class="container">
<view class="goodkind flexone">
<view class="goodkinditem" v-for="(item,index) in wantlist" :key="index" @click="sanji(item.id)">
<img :src="item.image" alt="" class="goodkindimg">
<view class="wantname">{{item.name}}</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: ["wantlist"],
data() {
return {
}
},
onLoad() {
},
methods: {
sanji(id){
uni.navigateTo({
url:"/pages/xinyuan/sanjikind?sanid="+id
})
}
}
}
</script>
<style>
@import url("../style/goodkind.css");
</style>
... ...
<template>
<view class="container">
<view class="goodkind flexone">
<view class="goodkinditem" v-for="(item,index) in wantlistone" :key="index" @click="sanji(item.id)">
<img :src="item.image" alt="" class="goodkindimg">
<view class="wantname">{{item.name}}</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: ["wantlistone"],
data() {
return {
}
},
onLoad() {
},
methods: {
sanji(id){
uni.navigateTo({
url:"/pages/xinyuan/sanjikind?sanid="+id
})
}
}
}
</script>
<style>
@import url("../style/goodkind.css");
</style>
... ...
<template>
<view class="container">
<view class="goodlist">
<view class="goodlistitem flex" v-for="(item,index) in zhigoodlist" :key="index" @click="entergood(item)">
<view class="goodlistimg">
<image :src="item.image" mode=""></image>
</view>
<view class="goodlistright">
<view class="goodrighttop flextwo">
<view class="goodname">{{item.name}}</view>
<view class="shareimg">
<image src="../static/share.png" mode="" class="sharebtn"></image>
<button open-type="share" class="shartype"></button>
</view>
</view>
<view class="zhibo flextwo">
<view class="zhiboleft" @click.stop="gozhubo(item.anchor.id)">{{item.anchor.name}}{{item.anchor.platform}}</view>
<view class="kaibo">{{item.anchor_time.time}}开播</view>
</view>
<view class="zhiboprice">
直播价 ¥<text class="pricege">{{item.live_price}}</text>
</view>
<view class="cankao flextwo">
<view class="cankaoleft">参考价(京东¥{{item.r_price}}元)</view>
<view v-if="item.status_data==1">
<view v-if="item.user_goods==0">
<view class="canlaoright flexone" v-if="item.share==true" >
<image src="../static/naoling.png" mode="" class="naoling"></image>
提醒我
<button open-type="share" class="sharebtnk" @click.stop="sharefriend(index,item.id,item.share)"></button>
</view>
<view class="canlaoright flexone" v-else @click.stop="tixing(index,item.id)">
<image src="../static/naoling.png" mode="" class="naoling"></image>
提醒我
</view>
</view>
<view class="canceltixing" v-else @click.stop="canceltixing(index,item.id)">
取消提醒
</view>
</view>
<view v-if="item.status_data==2">
<view class="canlaoright flexone">
已上架
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 弹出层 -->
<view class="register" v-if="noshow" @click="hideding">
<view class="registerwrap">
<view class="title">何时提醒我?</view>
<view class="titletext">在主播开始介绍商品时就提醒您</view>
<view class="title">如何提醒我</view>
<view class="titletext">在你允许消息通知后,届时会给您发送微信消息提醒</view>
<view class='noti flexone' @click.stop="notibtn">
<image src="../static/selectzhong.png" mode="" class="selectxuan" v-if="noti"></image>
<image src="../static/select.png" mode="" class="selectxuan" v-else></image>
不再提示
</view>
<button class="buzai" @click.stop="know" v-if="share==true" open-type="share">我知道了</button>
<view class="buzai" @click.stop="know" v-else>我知道了</view>
</view>
</view>
</view>
</template>
<script>
import app from "../App.vue"
export default {
// noting 是否显示不再提示 1 不再显示 空是显示
props: ["zhigoodlist","notixing","dingyuenum"],
data() {
return {
goods_id: '',
noti: false, //提示和不提示按钮
noshow: false, //提示我弹出层ss
goodindex: '',
share:'',
}
},
onLoad() {
},
onShow() {
},
onShareAppMessage(res) {
let that = this;
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '早直播',
path: '/pages/xinyuan/xinyuan'
}
},
methods: {
// 订阅消息
tixing(index, id) {
console.log(99)
let that = this;
if (uni.getStorageSync("token")) {
if (that.notixing == '') {
that.noshow = true
} else {
that.noshow = false
}
that.goodindex = index;
this.goods_id = id;
// that.dingyue()
wx.getSetting({
// withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.openSetting({ // 打开设置页
success(res) {
console.log(res.authSetting, 88888)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ["XrIccvxDK3IfW3DrnLtKAtKS-pL63BrG3W0Du9l7BrU"], //
success(res) {
// 去订阅
that.dingyue()
}
})
}
}
})
} else {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/mine/mine'
})
}, 1500)
}
},
// 取消订阅
canceltixing(index, id) {
this.goods_id = id;
this.goodindex = index;
this.dingyue()
},
// 订阅
dingyue() {
let that = this;
let url = "goods/addUserGoods";
let param = {
goods_id: that.goods_id
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
console.log(r, that.goodindex, '订阅')
let newdingyuenum=that.dingyuenum;
if (that.zhigoodlist[that.goodindex].user_goods == 0) {
that.zhigoodlist[that.goodindex].user_goods = 1;
if(newdingyuenum.indexOf(that.zhigoodlist[that.goodindex].id)==-1){
newdingyuenum.push(that.zhigoodlist[that.goodindex].id)
}
uni.showToast({
title: '订阅成功',
icon: "none"
})
} else {
that.zhigoodlist[that.goodindex].user_goods = 0;
newdingyuenum.forEach(function(value,index,array){
if(value==that.zhigoodlist[that.goodindex].id){
newdingyuenum.splice(index,1)
}
})
uni.showToast({
title: '取消订阅成功',
icon: "none"
})
}
// 直播个数超过10个 显示false
that.zhigoodlist.forEach(function(value,index,array){
if(newdingyuenum.length>=10){
if(value.user_goods ==0){
value.share=true
}
}else{
if(value.user_goods ==0){
value.share=false
}
}
})
that.zhigoodlist = that.zhigoodlist;
that.$forceUpdate();
that.$emit('tixing', that.zhigoodlist)
}).catch(err => {
console.log(err)
})
},
// 不再提醒
notibtn() {
this.noti = !this.noti;
if (this.noti == true) {
uni.setStorageSync("notixing", 1);
this.notixing=1
} else {
uni.setStorageSync("notixing", '');
this.notixing=''
}
},
// 我知道了
know() {
this.noshow = false
},
// 取消订阅
hideding() {
this.noshow = false
},
// 分享给好友
sharefriend(index,id,share) {
console.log(4398489)
let that = this;
if (uni.getStorageSync("token")) {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
if (that.notixing == '') {
that.noshow = true
} else {
that.noshow = false
}
that.goodindex = index;
that.goods_id = id;
that.share=share;
// that.dingyue()
wx.getSetting({
// withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.openSetting({ // 打开设置页
success(res) {
console.log(res.authSetting, 88888)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ["XrIccvxDK3IfW3DrnLtKAtKS-pL63BrG3W0Du9l7BrU"], //
success(res) {
// 去订阅
that.dingyue()
}
})
}
}
})
} else {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/mine/mine'
})
}, 1500)
}
},
// 进入链接页面
entergood(item){
uni.navigateTo({
url:"/pages/xinyuan/goodlianjie?code="+item.code+'&platform='+item.platform
})
},
// 进入主播页面
gozhubo(id){
uni.navigateTo({
url:'/pages/xinyuan/zhibodetail?id='+id
})
}
}
}
</script>
<style>
@import url("../style/goodlist");
</style>
... ...
<template>
<view class="container">
<view class="goodlist">
<view class="goodlistitem flex" v-for="(item,index) in listshilist" :key="index" @click="entergood(item)">
<view class="goodlistimg">
<image :src="item.image" mode=""></image>
</view>
<view class="goodlistright">
<view class="goodrighttop flextwo">
<view class="goodname">{{item.name}}</view>
<view class="shareimg">
<image src="../static/share.png" mode="" class="sharebtn"></image>
<button open-type="share" class="shartype"></button>
</view>
</view>
<view class="zhibo flextwo">
<view class="zhiboleft" @click="gozhubo(item.anchor.id)">{{item.anchor.name}}{{item.anchor.platform}}</view>
<view class="kaibo">{{item.anchor_time.time}}开播</view>
</view>
<view class="zhiboprice">
直播价 ¥<text class="pricege">{{item.live_price}}</text>
</view>
<view class="cankao flextwo">
<view class="cankaoleft">参考价(京东¥{{item.r_price}}元)</view>
<view v-if="item.status_data==1">
<view v-if="item.user_goods==0">
<view class="canlaoright flexone" v-if="item.share==true" >
<image src="../static/naoling.png" mode="" class="naoling"></image>
提醒我
<button open-type="share" class="sharebtnk" v-if="notixing==1" @click.stop="sharefriend(index,item.id,item.share)"></button>
</view>
<view class="canlaoright flexone" v-else @click.stop="tixing(index,item.id)">
<image src="../static/naoling.png" mode="" class="naoling"></image>
提醒我
</view>
</view>
<view class="canceltixing" v-else @click.stop="canceltixing(index,item.id)">
取消提醒
</view>
</view>
<view v-if="item.status_data==2">
<view class="canlaoright flexone">
已上架
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 弹出层 -->
<view class="register" v-if="noshow" @click="hideding">
<view class="registerwrap">
<view class="title">何时提醒我?</view>
<view class="titletext">在主播开始介绍商品时就提醒您</view>
<view class="title">如何提醒我</view>
<view class="titletext">在你允许消息通知后,届时会给您发送微信消息提醒</view>
<view class='noti flexone' @click="notibtn">
<image src="../static/selectzhong.png" mode="" class="selectxuan" v-if="noti"></image>
<image src="../static/select.png" mode="" class="selectxuan" v-else></image>
不再提示
</view>
<button class="buzai" @click.stop="know" v-if="share==true" open-type="share">我知道了</button>
<view class="buzai" @click.stop="know" v-else>我知道了</view>
</view>
</view>
</view>
</template>
<script>
import app from '../App.vue'
export default {
props: ["listshilist","mine","dingyuenumk"],
data() {
return {
goods_id: '',
noti: false, //提示和不提示按钮
noshow: false, //提示我弹出层
notixing: '', //不再提醒判断
goodindex: ''
}
},
onShareAppMessage(res) {
let that = this;
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '早直播',
path: '/pages/xinyuan/xinyuan'
}
},
onLoad() {
},
methods: {
// 订阅消息
tixing(index, id) {
let that = this;
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
console.log(that.notixing)
if (that.notixing == '') {
that.noshow = true
} else {
that.noshow = false
}
that.goodindex = index;
this.goods_id = id;
wx.getSetting({
// withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.openSetting({ // 打开设置页
success(res) {
console.log(res.authSetting, 88888)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ["XrIccvxDK3IfW3DrnLtKAtKS-pL63BrG3W0Du9l7BrU"], //
success(res) {
console.log(res, 99999)
that.dingyue()
}
})
}
}
})
},
// 取消订阅
canceltixing(index, id) {
this.goods_id = id;
this.goodindex = index;
this.dingyue()
},
// 订阅
dingyue() {
let that = this;
let url = "goods/addUserGoods";
let param = {
goods_id: that.goods_id
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
let newdingyuenumk=that.dingyuenumk;
if (that.listshilist[that.goodindex].user_goods == 0) {
that.listshilist[that.goodindex].user_goods = 1;
if(newdingyuenumk.indexOf(that.zhigoodlist[that.goodindex].id)==-1){
newdingyuenumk.push(that.zhigoodlist[that.goodindex].id)
}
uni.showToast({
title: '订阅成功',
icon: "none"
})
} else {
that.listshilist[that.goodindex].user_goods = 0;
newdingyuenumk.forEach(function(value,index,array){
if(value==that.zhigoodlist[that.goodindex].id){
newdingyuenumk.splice(index,1)
}
})
uni.showToast({
title: '取消订阅成功',
icon: "none"
})
}
// 直播个数超过10个 显示false
that.zhigoodlist.forEach(function(value,index,array){
if(newdingyuenumk.length>=10){
if(value.user_goods ==0){
value.share=true
}
}else{
if(value.user_goods ==0){
value.share=false
}
}
})
if(that.mine==1){
let newlistshilist=that.listshilist;
newlistshilist.splice(that.goodindex,1)
that.listshilist = newlistshilist;
}else{
that.listshilist = that.listshilist;
}
console.log(that.listshilist)
that.$forceUpdate();
that.$emit('litixing', that.listshilist)
}).catch(err => {
console.log(err)
})
},
// 不再提醒
notibtn() {
this.noti = !this.noti;
if (this.noti == true) {
uni.setStorageSync("notixing", 1);
this.notixing=1
} else {
uni.setStorageSync("notixing", '');
this.notixing=''
}
},
// 我知道了
know() {
this.noshow = false
},
// 取消订阅
hideding() {
this.noshow = false
},
// 分享给好友
sharefriend(index,id,share) {
let that = this;
if (uni.getStorageSync("token")) {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
if (that.notixing == '') {
that.noshow = true
} else {
that.noshow = false
}
that.goodindex = index;
that.goods_id = id;
that.share=share;
wx.getSetting({
// withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.openSetting({ // 打开设置页
success(res) {
console.log(res.authSetting, 88888)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ["XrIccvxDK3IfW3DrnLtKAtKS-pL63BrG3W0Du9l7BrU"], //
success(res) {
// 去订阅
that.dingyue()
}
})
}
}
})
} else {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/mine/mine'
})
}, 1500)
}
},
// 进入链接页面
entergood(item){
uni.navigateTo({
url:"/pages/xinyuan/goodlianjie?code="+item.code+'&platform='+item.platform
})
},
// 进入主播页面
gozhubo(id){
uni.navigateTo({
url:'/pages/xinyuan/zhibodetail?id='+id
})
}
}
}
</script>
<style>
@import url("../style/goodlist");
</style>
... ...
<template>
<view class="container">
<view class="goodlist">
<view class="goodlistitem flex" v-for="(item,index) in listshilist" :key="index" @cilck="entergood(item)">
<view class="goodlistimg">
<image :src="item.image" mode=""></image>
</view>
<view class="goodlistright">
<view class="goodrighttop flextwo">
<view class="goodname">{{item.name}}</view>
<view class="shareimg">
<image src="../static/share.png" mode="" class="sharebtn"></image>
</view>
</view>
<view class="zhibo flextwo">
<view class="zhiboleft">{{item.anchor.name}}{{item.anchor.platform}}</view>
<view class="kaibo">{{item.anchor_time.time}}开播</view>
</view>
<view class="zhiboprice">
直播价 ¥<text class="pricege">{{item.live_price}}</text>送同款234ml
</view>
<view class="cankao flextwo">
<view class="cankaoleft">参考价(京东¥{{item.r_price}}元)</view>
<view class="canceltixing" @click.stop="cancelti(index,item.id)">
取消提醒
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import app from "../App.vue"
export default {
props: ["listshilist"],
data() {
return {
}
},
onLoad() {
},
methods: {
// 取消提醒
cancelti(index,id){
let that = this;
var url = "goods/addUserGoods"
var param={
goods_id:id
}
app.post(url, param, "post").then(res => {
console.log('取消订阅', res)
uni.showToast({
title:"取消订阅成功",
icon:"none"
})
console.log(index)
let newlishsilist=that.listshilist;
newlishsilist.splice(index,1)
that.listshilist=newlishsilist;
that.$forceUpdate()
that.$emit('tixing', that.listshilist)
}).catch(err => {
console.log(err)
})
},
// 进入链接页面
entergood(item){
uni.navigateTo({
url:"/pages/xinyuan/goodlianjie?code="+item.code
})
}
}
}
</script>
<style>
@import url("../style/goodlist");
</style>
... ...
import Vue from 'vue'
import App from './App'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
... ...
{
"name" : "zhiboproject",
"appid" : "__UNI__700DE61",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
"usingComponents" : true,
"nvueCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* 模块配置 */
"modules" : {},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios" : {},
/* SDK配置 */
"sdkConfigs" : {}
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "wx7c6f9b9dbc7a7d94",
"setting" : {
"urlCheck" : false,
"postcss" : true
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
}
}
... ...
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/xinyuan/xinyuan",
"style": {
"navigationBarTitleText": "心愿商品",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的提醒",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/xinyuan/zhibodetail",
"style": {
"navigationBarTitleText": "主播详情",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/xinyuan/zhidetail",
"style": {
"navigationBarTitleText": "直播详情",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/zhubo/zhubo",
"style": {
"navigationBarTitleText": "主播列表",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/xinyuan/search",
"style": {
"navigationBarTitleText": "搜索",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/xinyuan/sanjikind",
"style": {
"navigationBarTitleText": "直播早知道",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/xinyuan/erjikind",
"style": {
"navigationBarTitleText": "直播早知道",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/xinyuan/goodlianjie",
"style": {
"navigationBarTitleText": "商品链接",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/xinyuan/zhiboknow",
"style": {
"navigationBarTitleText": "直播早知道",
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
}
],
"tabBar": {
"color": "#8C9299",
"selectedColor": "#FF5D8E",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/xinyuan/xinyuan",
"iconPath": "static/xinyuan.png",
"selectedIconPath": "static/xinyuanactive.png",
"text": "心愿商品"
}, {
"pagePath": "pages/zhubo/zhubo",
"iconPath": "static/zhibo.png",
"selectedIconPath": "static/zhiboactive.png",
"text": "主播列表"
},
{
"pagePath": "pages/mine/mine",
"iconPath": "./static/mine.png",
"selectedIconPath": "static/mineactive.png",
"text": "我的"
}
]
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
}
... ...
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
... ...
<template>
<view class="container">
<view class="minetop flexone">
<view class="minetopleft">
<image src="../../static/zhuboimg.png" mode="" v-if="userinfo==''"></image>
<image :src="userinfo.avatar" mode="" v-else></image>
</view>
<button class="minename" open-type="getUserInfo" @getuserinfo="wxGetUserInfo" v-if="userinfo==''">请先登录</button>
<view class="minename" v-else>{{userinfo.nickname}}</view>
</view>
<view class="tixinglist flextwo">
<view class="tixinglistitem" @click="tabclick(1)">
<image src="../../static/kaishou.png" mode="" class="kaiimg"></image>
<view class='kainame'>即将开售</view>
</view>
<view class="tixinglistitem" @click="tabclick(2)">
<image src="../../static/jitixing.png" mode="" class="kaiimg"></image>
<view class='kainame'>累计提醒</view>
</view>
<view class="tixinglistitem" @click="tabclick(3)">
<image src="../../static/guanzhu.png" mode="" class="kaiimg"></image>
<view class='kainame'>关注主播</view>
</view>
<view class="tixinglistitem" @click="tabclick(4)">
<image src="../../static/xinyuandan.png" mode="" class="kaiimg"></image>
<view class='kainame'>心愿商品</view>
</view>
</view>
<view class="nodata" v-if="listshilist.length==0">暂无数据</view>
<view v-else>
<!-- 即将开售 -->
<view class="kaishoulist" v-if="showclick==1">
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/jikaishou.png" mode="" class="likeimg"></image>
即将开售
</view>
</view>
<goodlistone :listshilist="listshilist" :mine="1" @litixing="litixing" ></goodlistone>
</view>
<!-- 累计提醒 -->
<view class="kaishoulist" v-if="showclick==2">
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/jikaishou.png" mode="" class="likeimg"></image>
累计提醒
</view>
</view>
<leiji :listshilist="listshilist" @tixing="tixing"></leiji>
</view>
<!-- 关注主播 -->
<view class="leiji" v-if="showclick==3">
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/guaznhuzhu.png" mode="" class="likeimg"></image>
关注主播
</view>
</view>
<view class='leijiitem flextwo' v-for="(item,index) in listshilist" :key="index">
<view class="leijiitemleft flexone">
<image :src="item.avatar" mode="" class="leijiimg"></image>
<view class="lejibox">
<view class="lejiname">{{item.name}}</view>
<view class='lejiatten' v-if="item.anchor_time!=null">{{item.anchor_time.title}}</view>
</view>
</view>
<view class="canceldingyuebtn" @click="cancelzhu(index,item.id)">取消订阅</view>
</view>
</view>
<!-- 心愿品类 -->
<view class="leiji" v-if="showclick==4">
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/xinyuangood.png" mode="" class="likeimg"></image>
心愿品类
</view>
</view>
<view class='leijiitem flextwo' v-for="(item,index) in listshilist" :key="index">
<view class="leijiitemleft flexone">
<image :src="item.image" mode="" class="leijiimg"></image>
<view class="lejibox">
<view class="lejiname">{{item.name}}</view>
</view>
</view>
<view class="canceldingyuebtn" @click="cancelxin(index,item.id)">取消订阅</view>
</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import goodlistone from "../../compontent/goodlistone.vue"
import leiji from "../../compontent/leiji.vue"
export default {
components: {
goodlistone,
leiji
},
data() {
return {
showclick: 1,
openid: "",
session_key: '',
encrypted_data: '',
iv: "",
userinfo: '', //用户信息
page: 1,
listshilist: [],
showpull: true,
dingyuenumk:[]
}
},
onLoad() {},
onShow() {
this.get_sessionkey();
if (uni.getStorageSync("token")) {
this.getuserinfo()
}
this.listshilist = [];
this.dingyuenumk=[]
this.page = 1;
this.getkaishou()
},
onReachBottom() {
that = this
let newpage = that.page;
newpage++
that.page = newpage;
if (that.showpull == true) {
console.log(38493409)
Toast('没有更多了~')
} else {
if (that.showclick == 1 || that.showclick == 2) {
that.getkaishou()
}
}
},
methods: {
//子元素传来的值
tixing(e) {
this.listshilist = e
},
litixing(e){
console.log(e)
this.listshilist = e
},
// 获取即将开售和累计提醒
getkaishou() {
let that = this;
let url = "user/getUserGoods";
let param = {
type: that.showclick,
page: that.page,
per_page: 20
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
console.log('即将开售', r)
that.listshilist = that.listshilist.concat(r.data);
if (that.page > 1) {
if (r.data.length == 0) {
that.showpull = false
}
}
that.listshilist.forEach(function(value,index,array){
if(value.user_goods==1){
if(that.dingyuenumk.indexOf(value.id)==-1){
that.dingyuenumk.push(value.id);
that.dingyuenumk=that.dingyuenumk
}
}
})
that.listshilist = that.listshilist;
that.$forceUpdate();
console.log(that.listshilist)
}).catch(err => {
console.log(err)
})
},
// 获取主播列表
getzhubolist() {
let that = this;
let url = "user/getAnchor";
let param = {
page: that.page,
per_page: 20
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
console.log('主播列表', r)
that.listshilist = that.listshilist.concat(r.data);
if (that.page > 1) {
if (r.data.length == 0) {
that.showpull = false
}
}
}).catch(err => {
console.log(err)
})
},
// 心愿商品
getxinyuan() {
let that = this;
let url = "user/getCategory";
let param = {
page: that.page,
per_page: 20
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
console.log('心愿商品', r)
that.listshilist = that.listshilist.concat(r.data);
if (that.page > 1) {
if (r.data.length == 0) {
that.showpull = false
}
}
}).catch(err => {
console.log(err)
})
},
// 取消订阅主播
cancelzhu(index, id) {
let that = this;
var url = "anchor/addUserAnchor"
var param = {
anchor_id: id
}
app.post(url, param, "post").then(res => {
console.log('取消订阅', res)
uni.showToast({
title: "取消订阅成功",
icon: "none"
})
console.log(index)
let newlishsilist = that.listshilist;
newlishsilist.splice(index, 1)
that.listshilist = newlishsilist;
that.$forceUpdate()
}).catch(err => {
console.log(err)
})
},
// 取消心愿商品
cancelxin(index,id){
let that = this;
var url = "category/addUserCate"
var param = {
cate_id: id
}
app.post(url, param, "post").then(res => {
console.log('取消订阅', res)
uni.showToast({
title: "取消订阅成功",
icon: "none"
})
console.log(index)
let newlishsilist = that.listshilist;
newlishsilist.splice(index, 1)
that.listshilist = newlishsilist;
that.$forceUpdate()
}).catch(err => {
console.log(err)
})
},
tabclick(id) {
this.showclick = id;
this.page = 1;
this.listshilist = [];
this.dingyuenumk=[]
if (this.showclick == 1 || this.showclick == 2) {
this.getkaishou()
} else if (this.showclick == 3) {
if (uni.getStorageSync("token")) {
this.getzhubolist()
}
} else if (this.showclick == 4) {
this.getxinyuan()
}
},
get_sessionkey() {
let that = this;
uni.login({
provider: "weixin",
success(r) {
console.log(r)
let url = "wechat/getSessionKey";
app.post(url, {
code: r.code
}, "post").then(r => {
console.log(r)
that.session_key = r.session_key;
that.openid = r.openid;
}).catch(err => {})
}
})
},
// 微信登录
wxGetUserInfo(e) {
console.log(e)
this.encrypted_data = e.detail.encryptedData
this.iv = e.detail.iv
this.login()
},
login() {
let that = this;
console.log('34898498')
uni.login({
provider: "weixin",
success(r) {
console.log(r, 6666)
let url = "wechat/login";
let param = {
openid: that.openid,
session_key: that.session_key,
encrypted_data: that.encrypted_data,
iv: that.iv,
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
console.log('登陆成功', r);
uni.setStorageSync("token", r.token)
that.getuserinfo()
// that.getuserinfo()
// uni.setStorageSync('openid', r.openid);
// uni.setStorageSync('session_key', r.session_key);
}).catch(err => {
console.log(err)
})
}
})
},
// 获取用户信息
getuserinfo() {
let that = this;
let url = "user/getUserInfo";
let param = {
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
console.log('用户信息', r)
that.userinfo = r
// that.getuserinfo()
// uni.setStorageSync('openid', r.openid);
// uni.setStorageSync('session_key', r.session_key);
}).catch(err => {
console.log(err)
})
}
}
}
</script>
<style>
@import url("../../style/xinyuan");
page {
background: #f5f5f5;
}
.want {
margin-top: 0
}
button {
margin: 0px;
padding: 0px;
/*自定义边框*/
border: none;
/*消除默认点击蓝色边框效果*/
outline: none;
background: transparent;
}
button::after {
border: none;
outline: none;
background: transparent;
}
button:focus {
border: 0 none;
outline: none;
background: transparent;
box-shadow: none;
}
button:active {
border: 0 none;
outline: none;
background: transparent;
box-shadow: none;
}
.register {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 5;
}
</style>
... ...
<template>
<view class="container">
<view class="want flextwo">
<view class="wantleft flexone">
热门品类推荐
</view>
</view>
<goodkind :wantlist="wantlist"></goodkind>
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/meizhuang.png" mode="" class="likeimg"></image>
近期美妆直播
</view>
</view>
<goodlist :zhigoodlist="zhigoodlist" :dingyuenum="dingyuenum" :nothing="notixing"></goodlist>
<!-- 这里也有你想要的 -->
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/like.png" mode="" class="likeimg"></image>
也许这里也又你想要的
</view>
<view class="more flexone" @click="more">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<goodkindone :wantlistone="wantlistone"></goodkindone>
</view>
</template>
<script>
import app from "../../App.vue";
import goodkind from "../../compontent/goodkind.vue"
import goodkindone from "../../compontent/goodkindone.vue"
import goodlist from "../../compontent/goodlist.vue"
export default {
components: {
goodkind,
goodlist,
goodkindone,
},
data() {
return {
search: false,
havesou: true,
goodshow:false,
wantlist:[],
showpull:true,
cate_one_id:'',//一级分类id
cate_two_id:'',//二级id
zhigoodlist:[],
wantlistone:[],
dingyuenum:[],
notixing:''
}
},
onLoad(options) {
if(options.type==1){
this.cate_one_id=options.id;
}else{
this.cate_two_id=options.id;
}
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
// 近期美妆直播
this.getnearlist()
// 获取热门品类
this.gethotkind();
// 这里有你想要的
this.getwant()
},
onReachBottom() {
that=this
let newpage=that.page;
newpage++
that.page=newpage;
if(that.showpull==true){
console.log(38493409)
Toast('没有更多了~')
}else{
that.getnearlist()
}
},
methods: {
// 获取热门分类
gethotkind(){
let that = this;
var url = "category/getRandCategory"
var param={
cate_one_id:that.cate_one_id,
type:2
}
app.post(url, param, "post").then(res => {
console.log('三级分类', res)
that.wantlist=res;
}).catch(err => {
console.log(err)
})
},
// 近期美妆直播
getnearlist(){
let that = this;
var url = "goods/getAnchorTimeGoods"
var param={
cate_one_id:that.cate_one_id,
cate_two_id:that.cate_two_id,
type:1
}
app.post(url, param, "post").then(res => {
console.log('商品列表', res)
that.zhigoodlist=that.zhigoodlist.concat(res.data);
if(that.page>1){
if(res.data.lenth==0){
that.showpull=false
}
}
console.log(that.zhigoodlist)
that.zhigoodlist.forEach(function(value,index,array){
if(value.user_goods==1){
if(that.dingyuenum.indexOf(value.id)==-1){
that.dingyuenum.push(value.id);
that.dingyuenum=that.dingyuenum
}
}
})
}).catch(err => {
console.log(err)
})
},
// 你想要的
getwant(){
let that = this;
var url = "category/getRandCategory"
let param={
// cate_one_id:that.cate_one_id,
// cate_two_id:that.cate_two_id,
limit:8
}
app.post(url, param, "post").then(res => {
console.log('我想要的', res)
that.wantlistone=res
}).catch(err => {
console.log(err)
})
},
// 查看更多
more(){
uni.navigateTo({
url:"/pages/xinyuan/zhiboknow"
})
}
}
}
</script>
<style>
@import url('../../style/xinyuan');
page {
padding: 0 32rpx;
box-sizing: border-box;
}
.searhtoppage {
padding: 0 32rpx;
box-sizing: border-box;
}
.fuzhi{
margin-top:92rpx
}
.copybtn{
margin:64rpx auto 32rpx
}
.fuzhitext{
text-align: center;
}
</style>
... ...
<template>
<view class="container">
<view class="fuzhi">
<view class="fuzhi">
<text class='step'>第一步</text>
复制口令码
</view>
</view>
<view class='codema'>{{codenumber}}</view>
<view class="copybtn" @click="copy">复制口令码</view>
<view class="fuzhik">
<view class="fuzhi fuzhitwo">
<text class='step steptwo'>第二步</text>
打开{{platform}}点击首页弹窗即可进入
</view>
</view>
<view class="want flextwo">
<view class="goodbox flexone">
<image src="../../static/today.png" mode="" class="todayimg"></image>
<view class="todayname">直播好物推荐</view>
</view>
<!-- <view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view> -->
</view>
<!-- 商品列表 -->
<goodlist :zhigoodlist="zhigoodlist" :notixing="notixing" @tixing='tixing' :dingyuenum="dingyuenum"></goodlist>
</view>
</template>
<script>
import app from "../../App.vue";
import goodlist from "../../compontent/goodlist.vue";
import {
Toast
} from "../../utils/toast.js"
var that
export default {
components: {
goodlist
},
data() {
return {
showpull: true,
page: 1,
zhigoodlist: [],
notixing: '',
codenumber: '',
dingyuenum:[],
platform:'',//平台名字s
}
},
onLoad(options) {
console.log(options)
this.codenumber = options.code;
this.platform=options.platform;
this.getgoodlist()
},
onShow() {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
},
onReachBottom() {
that = this
let newpage = that.page;
newpage++
that.page = newpage;
if (that.showpull == true) {
console.log(38493409)
Toast('没有更多了~')
} else {
that.getgoodlist()
}
},
methods: {
// 接收子组件的值
tixing(e) {
this.zhigoodlist = e
},
// 获取直播好物推荐
getgoodlist() {
let that = this;
var url = "goods/getAnchorTimeGoods"
var param = {
page: 1,
per_page: 20
}
app.post(url, {}, "post").then(res => {
console.log('商品列表', res)
that.zhigoodlist = that.zhigoodlist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false
}
}
that.zhigoodlist.forEach(function(value,index,array){
if(value.user_goods==1){
if(that.dingyuenum.indexOf(value.id)==-1){
that.dingyuenum.push(value.id);
that.dingyuenum=that.dingyuenum
}
}
})
}).catch(err => {
console.log(err)
})
},
// 复制到剪贴板
copy() {
uni.setClipboardData({
data: this.codenumber
});
}
}
}
</script>
<style>
@import url("../../style/xinyuan");
.container {
padding: 32rpx;
box-sizing: border-box;
}
</style>
... ...
<template>
<view class="container">
<!-- 搜索列表 -->
<view class="searchlist">
<!-- 搜索人 -->
<view class="searchitem flextwo">
<view class="searchitemleft flexone">
<image :src="info.image" mode="" class="headimg"></image>
<view>
<view class="searchheadname">{{info.name}}</view>
<view class="dingtixing flexone">
<view class="dingtixingitem" style="margin-right:20rpx" >订阅提醒</view>
<view class="dingtixingitem">品类预告微信提醒</view>
</view>
</view>
</view>
<view class="dingyue" v-if="info.user_cate==0" @click="dingyue">订阅直播</view>
<view class="dingyue" v-if="info.user_cate==1" @click="dingyue">取消订阅</view>
</view>
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/jinzhibo.png" mode="" class="likeimg"></image>
近期直播
</view>
<view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<goodlist :zhigoodlist="zhigoodlist" :notixing="notixing" @tixing="tixing" :dingyuenum="dingyuenum"></goodlist>
<view class="seemore" v-if="jinshowpull" @click="seejinmore">点击查看更多></view>
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/history.png" mode="" class="likeimg"></image>
历史直播
</view>
<view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<goodlistone :listshilist="listshilist" :notixing="notixing" @litixing="litixing" :dingyuenumk="dingyuenumk"></goodlistone>
<view class="seemore" v-if="hisshowpull" @click="seehismore">点击查看更多></view>
<view class="want flextwo" @click="hotmore">
<view class="wantleft flexone" >
<image src="../../static/hot.png" mode="" class="likeimg"></image>
热门品类推荐
</view>
<view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<goodkind :wantlist="wantlist"></goodkind>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import goodkind from "../../compontent/goodkind.vue"
import goodlist from "../../compontent/goodlist.vue"
import goodlistone from "../../compontent/goodlistone.vue"
export default {
components: {
goodkind,
goodlist,
goodlistone
},
data() {
return {
search: false,
havesou: true,
goodshow: false,
cate_one_id:'',//一级级id
cate_two_id:'',//二级id
cate_three_id:'',
wantlist:[],
zhigoodlist:[],
listshilist:[],
jinpage:1,
hispage:1,
jinshowpull:true,
hisshowpull:true,
info:'',//品类详情
notixing:'',
dingyuenum:[],//近期直播
dingyuenumk:[],//历史直播
}
},
onLoad(options) {
console.log(options.sanid)
if(options.id){
this.cate_one_id=options.id//一级级id
this.gethislist();
this.getnearlist();
}
if(options.secid){
this.cate_two_id=options.secid //二级id
this.gethislist();
this.getnearlist();
}
if(options.sanid){
this.cate_three_id=options.sanid //三级级id
this.gethislist();
this.getnearlist();
}
console.log(this.cate_three_id,'三级ID')
this.getsanji();
// 品类详情
this.getsanjidetail()
},
onShow() {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
},
methods: {
// 获取子组件的值
tixing(e){
this.zhigoodlist=e
},
litixing(e){
this.listshilist=e
},
// 订阅和取消订阅
dingyue(){
console.log(9999)
let that = this;
var url = "category/addUserCate"
let param = {
cate_id: that.cate_three_id
}
app.post(url, param, "post").then(res => {
console.log('主播订阅', res)
if(that.info.user_cate==0){
that.info.user_cate=1
uni.showToast({
title:"订阅成功",
icon:'none'
})
}else{
that.info.user_cate=0
uni.showToast({
title:"取消订阅成功",
icon:'none'
})
}
that.info=that.info;
that.$forceUpdate()
}).catch(err => {
console.log(err)
})
},
// 获取三级详情
getsanjidetail(){
let that = this;
var url = "category/getCategoryInfo"
let param={
cate_id:that.cate_three_id
}
app.post(url, param, "post").then(res => {
console.log('品类详情', res)
that.info=res
}).catch(err => {
console.log(err)
})
},
// 获取热门品类
getsanji(){
let that = this;
var url = "category/getRandCategory"
let param={
// cate_one_id:that.cate_one_id,
type:2,
}
app.post(url, param, "post").then(res => {
console.log('列表信息', res)
that.wantlist=res;
console.log(that.wantlist)
}).catch(err => {
console.log(err)
})
},
// 近期美妆直播
getnearlist(){
let that = this;
var url = "goods/getAnchorTimeGoods"
var param={
cate_one_id:that.cate_one_id,
cate_two_id:that.cate_two_id,
cate_three_id:that.cate_three_id,
type:1,
page:that.jinpage,
per_page:20
}
app.post(url, param, "post").then(res => {
console.log('商品列表', res)
if(res.data.length==0){
this.jinshowpull=false
}
that.zhigoodlist=that.zhigoodlist.concat(res.data);
that.zhigoodlist.forEach(function(value,index,array){
if(value.user_goods==1){
if(that.dingyuenum.indexOf(value.id)==-1){
that.dingyuenum.push(value.id);
that.dingyuenum=that.dingyuenum
}
}
})
console.log(that.zhigoodlist)
}).catch(err => {
console.log(err)
})
},
// 获取历史直播
gethislist(){
let that = this;
var url = "goods/getAnchorTimeGoods"
var param={
cate_one_id:that.cate_one_id,
cate_two_id:that.cate_two_id,
cate_three_id:that.cate_three_id,
type:2,
page:that.hispage,
per_page:20
}
app.post(url, param, "post").then(res => {
console.log('商品列表', res)
if(res.data.length==0){
that.hisshowpull=false
}
that.listshilist=that.listshilist.concat(res.data);
that.listshilist.forEach(function(value,index,array){
if(value.user_goods==1){
if(that.dingyuenumk.indexOf(value.id)==-1){
that.dingyuenumk.push(value.id);
that.dingyuenumk=that.dingyuenumk
}
}
})
}).catch(err => {
console.log(err)
})
},
// 近期直播查看更多
seejinmore(){
let newjinpage=this.jinpage;
newjinpage++;
this.jinpage=newjinpage;
if(this.jinshowpull==true){
this.getnearlist()
}
},
//历史美妆查看更多
seehismore(){
let newhispage=this.hispage;
newhispage++;
this.hispage=newhispage;
if(this.hisshowpull==true){
this.gethislist()
}
},
// 热门品类推荐查看更多
hotmore(){
uni.navigateTo({
url:'/pages/xinyuan/zhiboknow'
})
}
}
}
</script>
<style>
@import url('../../style/xinyuan');
page {
padding: 0 32rpx;
box-sizing: border-box;
}
.searchlist{
margin-top:0
}
.seemore{
color: #FF0000;
font-size: 28rpx;
text-align: center;
margin-top:20rpx;
}
.searhtoppage {
padding: 0 32rpx;
box-sizing: border-box;
}
.fuzhi {
margin-top: 92rpx
}
.copybtn {
margin: 64rpx auto 32rpx
}
.fuzhitext {
text-align: center;
}
</style>
... ...
<template>
<view class="container">
<view class="searhtoppage flextwo">
<view class="searchtopk flextwo">
<image src="../../static/search.png" mode="" class="search"></image>
<view class='searchleft'>
<input type="text" placeholder="输入您搜索的内容" v-model="keyword" @blur="searchbtn" />
</view>
</view>
<view class="cancelname" @click="cancel">取消</view>
</view>
<!-- 搜索 -->
<view class="searchbox" v-if="search">
<view>
<view class="searchboxtop flextwo">
<view class='searchboxleft flexone'>
<view class="hotname">历史搜索</view>
</view>
<view class="qingkong flexone" @click="clear">
<view class="qingkongname">清空</view>
<image src="../../static/shanchu.png" mode="" class="delimg"></image>
</view>
</view>
<view class="nodata" v-if="searchhis.length==0">暂无数据</view>
<view class="lishibox flexone" v-else>
<view class="lishoboxitme" v-for="(item,index) in searchhis" :key="index" @click="searchitem(item)">{{item}}</view>
</view>
</view>
<view class="searchboxtop flextwo" @click="more">
<view class='searchboxleft flexone'>
<image src="../../static/hot.png" mode="" class="hot"></image>
<view class="hotname">热门品类推荐</view>
</view>
<view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<goodkind :wantlist="wantlist"></goodkind>
</view>
<!-- 搜索列表 -->
<view class="searchlist" v-else>
<!--有搜搜结果 -->
<view class="searchitem flextwo" v-if="anchor.length!=0">
<view class="searchitemleft flexone" @click="enterpeople(anchor.id)">
<image :src="anchor.avatar" mode="" class="headimg"></image>
<view class="searchheadname">{{anchor.name}}</view>
</view>
<view class="dingyue" v-if="anchor.user_anchor==0" @click="dingyuepeople">订阅直播</view>
<view class="canceltixing" v-else @click="dingyuepeople">取消订阅</view>
</view>
<view class="searchitem flextwo" v-if="cate.length!=0">
<view class="searchitemleft flexone">
<image :src="cate.image" mode="" class="headimg"></image>
<view class="searchheadname">{{cate.name}}</view>
</view>
<view class="dingyue" v-if="cate.user_cate==0" @click="dingyuezhibo">订阅直播</view>
<view class="canceltixing" v-else @click="dingyuezhibo">取消订阅</view>
</view>
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/zan.png" mode="" class="likeimg"></image>
与“{{keyword}}”有关的直播
</view>
<view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<view>
<view class="nodata" v-if="zhigoodlist.length==0">暂无数据</view>
<view v-else>
<!-- 商品列表 -->
<goodlist :zhigoodlist="zhigoodlist"></goodlist>
</view>
</view>
<view class="want flextwo" @click='more'>
<view class='searchboxleft flexone'>
<image src="../../static/hot.png" mode="" class="hot"></image>
<view class="hotname">热门品类推荐</view>
</view>
<view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<goodkind :wantlist="wantlist"></goodkind>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import goodkind from "../../compontent/goodkind.vue"
import goodlist from "../../compontent/goodlist.vue"
import {
Toast
} from "../../utils/toast.js"
var that
export default {
components: {
goodkind,
goodlist
},
data() {
return {
search: true,
havesou: false,
goodshow: false,
wantlist: [],
keyword: '',
zhigoodlist: [],
showpull: true,
page: 1,
searchhis: [],
anchor: '',
cate: ''
}
},
onReachBottom() {
that = this
let newpage = that.page;
newpage++
that.page = newpage;
if (that.showpull == true) {
console.log(38493409)
Toast('没有更多了~')
} else {
that.getsearchresult()
}
},
onLoad() {
// 获取热门品类
this.getwant()
// 获取搜索列表
this.getsoulist()
},
methods: {
cancel() {
this.search = true;
this.keyword = ''
this.getsoulist()
},
// 获取搜索列表
getsoulist() {
let that = this;
var url = "keyword_log/getKeyword"
let param = {
}
app.post(url, param, "post").then(res => {
console.log('搜索列表', res)
that.searchhis = res
}).catch(err => {
console.log(err)
})
},
// 热门品类
getwant() {
let that = this;
var url = "category/getRandCategory"
let param = {
type: 2,
limit: 8
}
app.post(url, param, "post").then(res => {
console.log('我想要的', res)
that.wantlist = res
}).catch(err => {
console.log(err)
})
},
// 清空搜素记录
clear() {
let that = this;
uni.showModal({
title: '',
content: '是否清空搜索记录',
success: function(res) {
if (res.confirm) {
var url = "keyword_log/delKeyword"
let param = {
}
app.post(url, param, "post").then(res => {
Toast("删除成功");
that.searchhis = []
}).catch(err => {
console.log(err)
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
// 获取搜索
searchbtn() {
this.search = false;
this.page=1;
this.zhigoodlist=[];
this.getsearchresult();
},
// 获取搜索结果
getsearchresult() {
let that = this;
var url = "goods/search"
let param = {
keyword: that.keyword,
page: that.page,
per_apge: 20
}
app.post(url, param, "post").then(res => {
console.log('搜索结果', res)
that.anchor = res.anchor;
that.cate = res.cate
that.zhigoodlist = that.zhigoodlist.concat(res.list.data);
if (that.page > 1) {
if (res.list.data == 0) {
that.showpull = false
}
}
}).catch(err => {
console.log(err)
})
},
// 热门推荐更多
more() {
uni.navigateTo({
url: '/pages/xinyuan/zhiboknow'
})
},
// 订阅人
dingyuepeople() {
let that = this;
var url = "anchor/addUserAnchor"
let param = {
anchor_id: that.anchor.id
}
app.post(url, param, "post").then(res => {
console.log('搜索结果', res)
if (that.anchor.user_anchor == 0) {
that.anchor.user_anchor = 1;
Toast("订阅成功")
} else {
that.anchor.user_anchor = 0;
Toast("取消订阅成功")
}
that.anchor = that.anchor;
that.$forceUpdate()
}).catch(err => {
console.log(err)
})
},
// 订阅品类
dingyuezhibo() {
let that = this;
var url = "category/addUserCate"
let param = {
cate_id: that.cate.id
}
app.post(url, param, "post").then(res => {
console.log('搜索结果', res)
if (that.cate.user_cate == 0) {
that.anchor.user_cate = 1;
Toast("订阅成功")
} else {
that.anchor.user_cate = 0;
Toast("取消订阅成功")
}
that.cate = that.cate;
that.$forceUpdate()
}).catch(err => {
console.log(err)
})
},
searchitem(item) {
this.keyword = item;
this.getsearchresult();
this.search = false
},
// 进入主播详情
enterpeople(id){
console.log(id)
uni.navigateTo({
url:'/pages/xinyuan/zhibodetail?id='+id
})
}
}
}
</script>
<style>
@import url('../../style/xinyuan');
page {
padding: 0 32rpx;
box-sizing: border-box;
}
.searhtoppage {
padding: 0 32rpx;
box-sizing: border-box;
}
.fuzhi {
margin-top: 92rpx
}
.copybtn {
margin: 64rpx auto 32rpx
}
.fuzhitext {
text-align: center;
}
.lishibox {
margin-top: 24rpx;
flex-wrap: wrap;
}
.lishoboxitme {
background: #f7f8fa;
border-radius: 8rpx;
padding: 8rpx 16rpx;
box-sizing: border-box;
color: #252F3E;
font-size: 24rpx;
margin-bottom: 20rpx;
margin-right: 10rpx;
}
.canceltixing {
width: 144rpx;
height: 48rpx;
background: #bbbbbb;
border-radius: 10rpx;
color: #fff;
font-size: 24rpx;
text-align: center;
line-height: 48rpx;
}
</style>
... ...
<template>
<view class="container">
<view class="searhtoppage">
<view class="searchtop flextwo" @click="search">
<view class='searchleft'>
输入您搜索的内容
<!-- <input type="text" placeholder="输入您搜索的内容" /> -->
</view>
<image src="../../static/search.png" mode="" class="search"></image>
</view>
</view>
<view class="xinyuanbox">
<view class="gookindpage flexone">
<view class="goodkindleft" @click='all("")'>
<view class="goodkindname">全部品类</view>
<view class="secname allname">香奈儿奢华至臻</view>
<view class="goodkindimgbox">
<view class="gookindimg">
<image src="../../static/goodimg.png" mode=""></image>
</view>
</view>
</view>
<view class="goodkindright">
<view class="goodkindrighttop flexone" @click='all(kindlist[0].id)'>
<view>
<view class="goodkindname">{{kindlist[0].name}}</view>
<view class="secname">{{kindlist[0].description}}</view>
</view>
<view class="gookindimgk">
<image :src="kindlist[0].image" mode=""></image>
</view>
</view>
<view class="goodkindrighttopge flexone" @click='all(kindlist[1].id)'>
<view>
<view class="goodkindname">{{kindlist[1].name}}</view>
<view class="secname">{{kindlist[1].description}}</view>
</view>
<view class="gookindimgk">
<image :src="kinlist[1].image" mode=""></image>
</view>
</view>
</view>
</view>
<view class="xinyuanbotbox flextwo">
<view class="xinyuanbotitem flexone" @click='all(kindlist[2].id)'>
<view>
<view class="goodkindnamek">{{kindlist[2].name}}</view>
<view class="secnamek">{{kindlist[2].description}}</view>
</view>
<view class="goodkindimg">
<image :src="kindlist[2].image" mode=""></image>
</view>
</view>
<view class="xinyuanbotitem flexone" @click='all(kindlist[3].id)'>
<view>
<view class="goodkindnamek">{{kindlist[3].name}}</view>
<view class="secnamek">{{kindlist[3].description}}</view>
</view>
<view class="goodkindimg">
<image :src="kindlist[3].image" mode=""></image>
</view>
</view>
<view class="xinyuanbotitem flexone" @click='all(kindlist[4].id)'>
<view>
<view class="goodkindnamek">{{kindlist[4].name}}</view>
<view class="secnamek">{{kindlist[4].description}}</view>
</view>
<view class="goodkindimg">
<image :src="kindlist[4].image" mode=""></image>
</view>
</view>
</view>
<!-- 直播好物推荐 -->
<view class="goodbox flexone">
<image src="../../static/today.png" mode="" class="todayimg"></image>
<view class="todayname">直播好物推荐</view>
</view>
<!-- 商品列表 -->
<goodlist :zhigoodlist="zhigoodlist" :notixing="notixing" @tixing='tixing' :dingyuenum="dingyuenum"></goodlist>
<!-- 这里也有你想要的 -->
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/like.png" mode="" class="likeimg"></image>
也许这里也又你想要的
</view>
<view class="more flexone" @click="more">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<goodkind :wantlist="wantlist"></goodkind>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import goodlist from "../../compontent/goodlist.vue";
import goodkind from "../../compontent/goodkind.vue";
import {
Toast
} from "../../utils/toast.js"
var that
export default {
components: {
goodlist,
goodkind
},
data() {
return {
// 列表
kindlist: [],
showpull: true,
wantlist: [],
page: 1,
zhigoodlist: [],
notixing:'',
dingyuenum:[]
}
},
onReachBottom() {
that = this
let newpage = that.page;
newpage++
that.page = newpage;
if (that.showpull == true) {
console.log(38493409)
Toast('没有更多了~')
} else {
that.getgoodlist()
}
},
onShow() {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
console.log(this.notixing)
this.page=1;
this.zhigoodlist=[]
// 获取直播好物
this.getgoodlist();
},
onLoad() {
this.gettopkind();
// 获取你想要的
this.getwant()
},
methods: {
// 接收子组件的值
tixing(e) {
this.zhigoodlist = e;
},
// 获取顶部列表
gettopkind() {
let that = this;
var url = "category/getIndexCategory"
app.post(url, {}, "post").then(res => {
console.log('列表信息', res)
that.kindlist = res;
console.log(that.kindlist)
}).catch(err => {
})
},
// 获取直播好物推荐
getgoodlist() {
let that = this;
var url = "goods/getAnchorTimeGoods"
var param = {
page: 1,
per_page: 20
}
app.post(url, {}, "post").then(res => {
console.log('商品列表', res)
that.zhigoodlist = that.zhigoodlist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false
}
}
that.zhigoodlist.forEach(function(value,index,array){
if(value.user_goods==1){
if(that.dingyuenum.indexOf(value.id)==-1){
that.dingyuenum.push(value.id);
that.dingyuenum=that.dingyuenum
}
}
})
}).catch(err => {
console.log(err)
})
},
// 你想要的
getwant() {
let that = this;
var url = "category/getRandCategory"
let param = {
type: 2,
limit: 8
}
app.post(url, param, "post").then(res => {
console.log('我想要的', res)
that.wantlist = res
}).catch(err => {
console.log(err)
})
},
// 更多分类
more() {
uni.navigateTo({
url: "/pages/xinyuan/zhiboknow"
})
},
// 进入搜索页面
search() {
uni.navigateTo({
url: '/pages/xinyuan/search'
})
},
// 进入分类页面
all(id){
uni.navigateTo({
url:'/pages/xinyuan/zhiboknow?id='+id
})
}
}
}
</script>
<style>
@import url('../../style/xinyuan');
</style>
... ...
<template>
<view class="container">
<view class="zhibotopbox">
<view class="zhibotaltop flexone">
<view class="zhibohead">
<image :src="info.avatar" mode=""></image>
</view>
<view class="zhiboright">
<view class="zhubotail flextwo">
<view class="tailrighttop flexone">
<view class="tailname">{{info.name}}</view>
<view class="taillabel">{{info.platform}}</view>
</view>
<view class="shareimg">
<image src="../../static/share.png" mode="" class="sharebtn"></image>
<button open-type="share" class="shartype"></button>
</view>
</view>
<view class='tailrightbot flexone'>
<view class="tailzhibo" v-if="info.user_anchor==0" @click="dingyuezhi">订阅直播</view>
<view class="tailzhibo" v-if="info.user_anchor==1" @click="dingyuezhi">取消订阅</view>
<view class='taildate' v-if="info.anchor_time!=null">{{info.anchor_time.time}}开播</view>
</view>
<view class="dongtai flexone" v-if="info.user_anchor==0&&guanzhu==0" @click="hidegaunzhu">
<veiw>订阅主播,随时获取主播动态</veiw>
<view class="chahaoimg">
<img src="../../static/chahao.png" alt="" >
</view>
</view>
</view>
</view>
<view class="zhibonametext" v-if="info.anchor_time!=null">{{info.anchor_time.title}}</view>
</view>
<view class="zhibotailtab flextwo">
<view class="zhibotailtableft" :class="begin==1?'zhibotailactive':''" @click="beginstart(1)">即将开始</view>
<view class="zhibotailtableft" :class="begin==2?'zhibotailactive':''" @click="beginstart(2)">历史场次</view>
<img src="../../static/search.png" alt="" class="souimg" @click='searchenter'>
</view>
<!-- 即将开始 -->
<view class='beginlist' v-if="begin==1">
<!-- v-if="info.button==true" -->
<view class='beginlisttop flexone' v-if="button">
<view class="begintopitem" :class="sel==''?'selactive':''" @click="select('')">所有商品</view>
<view class="begintopitem" :class="sel==1?'selactive':''" @click="select('1')">今天</view>
<view class="begintopitem" :class="sel==2?'selactive':''" @click="select('2')">明天</view>
</view>
<view>
</view>
<view v-if="beginlist.length!=0">
<view v-for="(item,index) in beginlist" :key="index">
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/meizhuanglei.png" mode="" class="likeimg"></image>
{{item.name}}
</view>
<!-- <view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view> -->
</view>
<view class="goodlist">
<view class="goodlistitem flex" v-for="(itemk,indexk) in item.child" :key="indexk" @click="entergood(itemk)">
<view class="goodlistimg">
<image :src="itemk.image" mode=""></image>
</view>
<view class="goodlistright">
<view class="goodrighttop flextwo">
<view class="goodname">{{itemk.name}}</view>
<view class="shareimg">
<image src="../../static/share.png" mode="" class="sharebtn"></image>
<button open-type="share" class="shartype"></button>
</view>
</view>
<view class="zhibo flextwo">
<view class="zhiboleft">{{itemk.anchor.name}}{{itemk.anchor.platform}}</view>
<view class="kaibo">{{itemk.anchor_time.time}}开播</view>
</view>
<view class="zhiboprice">
直播价 ¥<text class="pricege">{{itemk.live_price}}</text>
</view>
<view class="cankao flextwo">
<view class="cankaoleft">参考价(京东¥{{itemk.r_price}}元)</view>
<view v-if="itemk.status_data==1">
<view v-if="itemk.user_goods==0">
<view class="canlaoright flexone" v-if="itemk.share==true" >
<image src="../../static/naoling.png" mode="" class="naoling"></image>
提醒我
<button open-type="share" class="sharebtnk" v-if="notixing==1" @click.stop="sharefriend(index,indexk,itemk.id,item.share)"></button>
</view>
<view class="canlaoright flexone" v-else @click.stop="tixing(index,indexk,itemk.id)">
<image src="../../static/naoling.png" mode="" class="naoling"></image>
提醒我
</view>
</view>
<view class="canceltixing" v-else @click.stop="canceltixing(index,indexk,itemk.id)">
取消提醒
</view>
</view>
<view v-if="itemk.status_data==2">
<view class="canlaoright flexone" >
已上架
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 这里也有你想要的 -->
<view class="want flextwo" >
<view class="wantleft flexone">
<image src="../../static/like.png" mode="" class="likeimg"></image>
也许这里也又你想要的
</view>
<!-- <view class="more flexone" @click="seemore">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view> -->
</view>
<goodkind :wantlist="wantlist"></goodkind>
<!-- 没有直播时显示 -->
<view class="nodatabox" v-if="beginlist.length==0">
<view class="nodataimg">
<image src="../../static/nodataimg.png" mode=""></image>
</view>
<view class="nodataword">当前主播还未发布预告,点击订阅TA的预告提醒</view>
<view class="nodatabtn" @click="dingyuezhi" v-if="info.user_anchor==0">订阅TA的预告提醒</view>
<view class="nodatabtn" @click="dingyuezhi" v-if="info.user_anchor==1">取消订阅TA的预告提醒</view>
</view>
</view>
<!-- 历史场次 -->
<view class="zhibotaillist" v-else>
<view class="nodata" v-if="hislist.length==0">暂无数据</view>
<view v-else>
<view class="zhibotialitem flextwo" v-for="(item,index) in hislist" :key="index" @click="zhidetail(item.id)">
<view class='zhibotialleft'>
<view class='zhibotailleftname'>{{item.title}}</view>
<view class="zhibotaildate">{{item.time}}</view>
</view>
<view class="yourowk">
<image src="../../static/yourow.png" mode=""></image>
</view>
</view>
</view>
</view>
<!-- 弹出层 -->
<view class="register" v-if="noshow" @click="hideding">
<view class="registerwrap">
<view class="title">何时提醒我?</view>
<view class="titletext">在主播开始介绍商品时就提醒您</view>
<view class="title">如何提醒我</view>
<view class="titletext">在你允许消息通知后,届时会给您发送微信消息提醒</view>
<view class='noti flexone' @click="notibtn">
<image src="../static/selectzhong.png" mode="" class="selectxuan" v-if="noti"></image>
<image src="../static/select.png" mode="" class="selectxuan" v-else></image>
不再提示
</view>
<button class="buzai" @click.stop="know" v-if="share==true" open-type="share">我知道了</button>
<view class="buzai" @click.stop="know" v-else>我知道了</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import goodkind from "../../compontent/goodkind.vue"
import {Toast} from "../../utils/toast.js"
var that
export default {
components: {
goodkind
},
data() {
return {
begin: 1,
hasgood: false,
zhiboid: "",
info: '',
sel: '',
beginlist:[],
page:1,
wantlist:[],
hislist:[],
showpull:true,
notixing:'',
goods_id: '',
noti: false, //提示和不提示按钮
noshow: false, //提示我弹出层
goodindex: '',
goodparindex:'',
share:'',
button:false,//是否显示所有商品 今天 明天
guanzhu:0,//是否显示主播动态
dingyuenum:[],
}
},
onLoad(options) {
if(uni.getStorageSync("guanzhu")){
this.guanzhu=uni.getStorageSync("guanzhu")
}
this.zhiboid = options.id;
// 获取主播详情
this.getzhibodetail();
this.getbeginlist();
// 获取想要的
this.getwant()
},
onShow() {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
},
onShareAppMessage(res) {
let that = this;
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '早直播',
path:'/pages/xinyuan/zhibodetail?id='+this.zhiboid
}
},
onReachBottom() {
that=this
let newpage=that.page;
newpage++
that.page=newpage;
if(that.showpull==true){
console.log(38493409)
Toast('没有更多了~')
}else{
if(this.begin==1){
that.getbeginlist()
}else{
this.gethislist()
}
}
},
methods: {
// 关注关注
hidegaunzhu(){
uni.setStorageSync("guanzhu",1)
this.guanzhu=1
},
// 查看更多
seemore() {
uni.navigateTo({
url: "/pages/xinyuan/zhiboknow"
})
},
beginstart(id) {
this.begin = id;
this.page=1;
this.beginlist=[];
this.hislist=[]
if(id==1){
this.getbeginlist()
}else{
this.gethislist()
}
},
// 全部 今天 明天
select(id) {
this.sel = id;
this.page=1;
this.beginlist=[];
this.getbeginlist()
},
// 直播详情
getzhibodetail() {
let that = this;
var url = "anchor/getAnchorInfo"
let param = {
anchor_id: that.zhiboid
}
app.post(url, param, "post").then(res => {
console.log('主播详情', res)
that.info=res;
that.button=res.button;
that.$forceUpdate();
}).catch(err => {
console.log(err)
})
},
// 订阅直播
dingyuezhi(){
console.log(9999)
let that = this;
var url = "anchor/addUserAnchor"
let param = {
anchor_id: that.zhiboid
}
app.post(url, param, "post").then(res => {
console.log('主播订阅', res)
if(that.info.user_anchor==0){
that.info.user_anchor=1;
uni.showToast({
title:'订阅成功',
icon:'none'
})
}else{
that.info.user_anchor=0;
uni.showToast({
title:'取消订阅成功',
icon:'none'
})
}
that.info=that.info;
that.$forceUpdate()
}).catch(err => {
console.log(err)
})
},
// 获取即将开播
getbeginlist() {
let that = this;
var url = "anchor/getAnchorGoods"
let param = {
anchor_id: that.zhiboid,
type: that.sel,
page: that.page,
per_page: 20
}
app.post(url, param, "post").then(res => {
console.log('即将开播', res)
that.beginlist=that.beginlist.concat(res)
if(that.page>1){
if(res.data.length==0){
that.showpull=false
}
}
that.beginlist.forEach(function(value,index,array){
value.child.forEach(function(valuek,indexk,arrayk){
if(valuek.user_goods==1){
if(that.dingyuenum.indexOf(valuek.id)==-1){
that.dingyuenum.push(valuek.id);
that.dingyuenum=that.dingyuenum
}
}
})
})
console.log('订阅数量',that.dingyuenum)
}).catch(err => {
console.log(err)
})
},
gethislist(){
let that = this;
var url = "anchor/getAnchorTime"
let param = {
anchor_id: that.zhiboid,
page: that.page,
per_page: 20
}
app.post(url, param, "post").then(res => {
console.log('历史列表', res)
that.hislist=that.hislist.concat(res.data);
if(that.page>1){
if(res.data.length==0){
that.showpull=false
}
}
}).catch(err => {
console.log(err)
})
},
// 你想要的
getwant(){
let that = this;
var url = "category/getRandCategory"
let param={
limit:8
}
app.post(url, param, "post").then(res => {
console.log('我想要的', res)
that.wantlist=res
}).catch(err => {
console.log(err)
})
},
// 订阅消息
tixing(index,indexk,id) {
console.log(99)
let that = this;
if (uni.getStorageSync("token")) {
if (that.notixing == '') {
that.noshow = true
} else {
that.noshow = false
}
that.goodindex = indexk;
that.goodparindex=index;
this.goods_id = id;
// that.dingyue()
wx.getSetting({
// withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.openSetting({ // 打开设置页
success(res) {
console.log(res.authSetting, 88888)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ["XrIccvxDK3IfW3DrnLtKAtKS-pL63BrG3W0Du9l7BrU"], //
success(res) {
// 去订阅
that.dingyue()
}
})
}
}
})
} else {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/mine/mine'
})
}, 1500)
}
},
// 取消订阅
canceltixing(index,indexk, id) {
this.goods_id = id;
this.goodparindex = index;
this.goodindex=indexk;
this.dingyue()
},
// 订阅
dingyue() {
let that = this;
let url = "goods/addUserGoods";
let param = {
goods_id: that.goods_id
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
console.log(r,that.goodparindex, that.goodindex, '订阅')
let newdingyuenum=that.dingyuenum;
if (that.beginlist[that.goodparindex].child[that.goodindex].user_goods == 0) {
that.beginlist[that.goodparindex].child[that.goodindex].user_goods= 1;
if(newdingyuenum.indexOf(that.beginlist[that.goodparindex].child[that.goodindex].id)==-1){
newdingyuenum.push(that.beginlist[that.goodparindex].child[that.goodindex].id)
}
uni.showToast({
title: '订阅成功',
icon: "none"
})
} else {
that.beginlist[that.goodparindex].child[that.goodindex].user_goods= 0;
newdingyuenum.forEach(function(value,index,array){
if(value==that.beginlist[that.goodparindex].child[that.goodindex].id){
newdingyuenum.splice(index,1)
}
})
uni.showToast({
title: '取消订阅成功',
icon: "none"
})
}
// 直播个数超过10个 显示false
that.beginlist.forEach(function(value,index,array){
value.child.forEach(function(valuek,indexk,arrayk){
if(newdingyuenum.length>=10){
if(valuek.user_goods ==0){
valuek.share=true
}
}else{
if(valuek.user_goods ==0){
valuek.share=false
}
}
})
})
that.beginlist = that.beginlist;
that.$forceUpdate();
}).catch(err => {
console.log(err)
})
},
// 不再提醒
notibtn() {
this.noti = !this.noti;
if (this.noti == true) {
uni.setStorageSync("notixing", 1);
this.notixing=1
} else {
uni.setStorageSync("notixing", '');
this.notixing=''
}
},
// 我知道了
know() {
this.noshow = false
},
// 取消订阅
hideding() {
this.noshow = false
},
// 分享给好友
sharefriend(index,indexk,id,share) {
console.log(4398489)
let that = this;
if (uni.getStorageSync("token")) {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
if (that.notixing == '') {
that.noshow = true
} else {
that.noshow = false
}
that.goodindex = index;
that.goods_id = id;
that.share=share;
// that.dingyue()
wx.getSetting({
// withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.openSetting({ // 打开设置页
success(res) {
console.log(res.authSetting, 88888)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ["XrIccvxDK3IfW3DrnLtKAtKS-pL63BrG3W0Du9l7BrU"], //
success(res) {
// 去订阅
that.dingyue()
}
})
}
}
})
} else {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/mine/mine'
})
}, 1500)
}
},
// 进入直播详情
zhidetail(id){
uni.navigateTo({
url:"/pages/xinyuan/zhidetail?id="+id+'&zhiboid='+this.zhiboid
})
},
// 进入链接页面
entergood(item){
uni.navigateTo({
url:"/pages/xinyuan/goodlianjie?code="+item.code
})
},
searchenter(){
uni.navigateTo({
url:"/pages/xinyuan/search"
})
}
}
}
</script>
<style>
@import url("../../style/xinyuan");
@import url("../../style/goodlist");
page {
background: #f5f5f5;
}
.shareimg{
position: relative;
}
.tailzhibo {
font-size: 28rpx
}
.want {
margin-top: 0;
padding-top: 20rpx
}
.zhibotailtab{
position: relative;
}
.souimg{
width: 36rpx;
height: 36rpx;
position: absolute;
right: 86rpx;
bottom: 33rpx;
}
.chahaoimg{
width:36rpx;
height: 36rpx;
margin-left:10rpx;
font-size: 0;
}
.dongtai{
width:414rpx;
padding: 10rpx;
box-sizing: border-box;
border-radius: 10rpx;
border:1rpx solid #FF5D8E;
color:#FF5D8E;
font-size:28rpx;
margin-top:20rpx;
display:flex;
align-items: center;
}
</style>
... ...
<template>
<view class="containerk">
<view class="searhtoppage flextwo">
<view class="searchtopk flextwo" @click='entersearch'>
<image src="../../static/search.png" mode="" class="search"></image>
<view class='searchleft'>
输入您搜索的内容
</view>
</view>
<view class="cancelname">取消</view>
</view>
<view class="knowkind flexone">
<view class="knowkindleft">
<view class="knowkindleftitem" :class="selone==index?'knowkindactive':''" v-for="(item,index) in firstlist" :key="index"
@click="selkind(item.id,index)">{{item.name}}</view>
</view>
<view class="knowkindright">
<view class="nodata" v-if="seclist.length==0">暂无数据</view>
<view v-else>
<view class="knowkindfightitem" v-for="(item,index) in seclist" :key="index">
<view class="knowtopbox flextwo">
<view class="knowtopname">{{item.name}}</view>
<view class="more flexone" @click="seemorekind(item.id)">
查看所有美妆
<img src="../../static/yourow.png" alt="" class="yourow">
</view>
</view>
<view class="knowtoplist flexone">
<view class="knowtoplistitem" v-for="(itemk,indexk) in item.child" :key="indexk" @click="jumpsanji(item.id,itemk.id)">
<view class="knowtopimg">
<image :src="itemk.image" mode=""></image>
</view>
<view class="knowword">{{itemk.name}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import goodlist from "../../compontent/goodlist.vue";
import goodkind from "../../compontent/goodkind.vue";
export default {
components: {
goodlist,
goodkind
},
data() {
return {
firstlist: [],
cate_id: '', //一级分类id
seclist: [],
selone: 0,
id: "", //分类id
}
},
onLoad(options) {
this.getkind()
if (options.id) {
this.id = options.id //分类id
}
},
methods: {
// 获取分类 一级
getkind() {
let that = this;
var url = "category/getCategoryOne"
let param = {
}
app.post(url, param, "post").then(res => {
console.log('我想要的', res)
that.firstlist = res;
if (that.id != '') {
that.firstlist.forEach(function(value, index,array) {
if (value.id == that.id) {
that.cate_id = value.id;
that.selone=index
}
})
} else {
that.cate_id = res[0].id
}
that.getseclist()
}).catch(err => {
console.log(err)
})
},
selkind(id, index) {
this.cate_id = id;
this.seclist = [];
this.selone = index;
this.getseclist()
},
// 获取二级分类
getseclist() {
let that = this;
var url = "category/getCategory"
let param = {
cate_id: that.cate_id
}
app.post(url, param, "post").then(res => {
console.log('我想要的', res)
that.seclist = res;
}).catch(err => {
console.log(err)
})
},
// 跳转三级分类
jumpsanji(erid, sanid) {
uni.navigateTo({
url: "/pages/xinyuan/sanjikind?id=" + this.cate_id + '&secid=' + erid + '&sanid=' + sanid //cate_id 一级分类id id 二级分类id
})
},
// 查看更多跳转二级分类
seemorekind(id) {
if (this.cate_id == 0) {
uni.navigateTo({
url: "/pages/xinyuan/erjikind?id=" + id + '&type=' + 1 //一级分类id
})
} else {
if (id == 0) {
uni.navigateTo({
url: "/pages/xinyuan/erjikind?id=" + this.cate_id + '&type=' + 1 //一级分类id
})
} else {
uni.navigateTo({
url: "/pages/xinyuan/erjikind?id=" + id + '&type=' + 2 //二级分类id
})
}
}
},
// 进入搜索页面
entersearch() {
uni.navigateTo({
url: '/pages/xinyuan/search'
})
},
}
}
</script>
<style>
@import url("../../style/xinyuan");
.containerk {
padding: 32rpx 28rpx;
box-sizing: border-box;
}
.searhtoppage {
padding: 0 32rpx;
box-sizing: border-box;
}
</style>
... ...
<template>
<view class="container">
<view class="zhibotopbox">
<view class="zhibotaltop flexone">
<view class="zhibohead">
<image :src="info.avatar" mode=""></image>
</view>
<view class="zhiboright">
<view class="zhubotail flextwo">
<view class="tailrighttop flexone">
<view class="tailname">{{info.name}}</view>
<view class="taillabel">{{info.platform}}</view>
</view>
<view class="shareimg">
<image src="../../static/share.png" mode="" class="sharebtn"></image>
<button open-type="share" class="shartype"></button>
</view>
</view>
<view class='tailrightbot flexone'>
<view class="tailzhibo" v-if="info.user_anchor==0" @click="dingyuezhi">订阅直播</view>
<view class="tailzhibo" v-if="info.user_anchor==1" @click="dingyuezhi">取消订阅</view>
<view class='taildate' v-if="info.anchor_time!=null">{{info.anchor_time.time}}开播</view>
</view>
</view>
</view>
<view class="zhibonametext" v-if="info.anchor_time!=null">{{info.anchor_time.title}}</view>
</view>
<!-- 主播种类 -->
<view class="zhubokind flextwo">
<view class="zhubokinditem">
<view class="zhuboimg">
<image src="../../static/yulan.png" mode=""></image>
<view class='yuanquan'></view>
</view>
<view class="zhubokindname">浏览预告</view>
<view class="setname">设置商品提醒</view>
</view>
<view class="zhubokinditem">
<view class="zhuboimg">
<image src="../../static/intro.png" mode=""></image>
<view class='yuanquan'></view>
</view>
<view class="zhubokindname">主播介绍</view>
<view class="setname">立刻推送提醒</view>
</view>
<view class="zhubokinditem">
<view class="zhuboimg">
<image src="../../static/tixing.png" mode=""></image>
<view class='yuanquan'></view>
</view>
<view class="zhubokindname">收到提醒</view>
<view class="setname">打开软件购买</view>
</view>
</view>
<!-- 即将开始 -->
<!-- v-if="info.button==true" -->
<view v-if="beginlist.length!=0">
<view v-for="(item,index) in beginlist" :key="index" style="padding: 0 32rpx;box-sizing: border-box;">
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/meizhuanglei.png" mode="" class="likeimg"></image>
{{item.name}}
</view>
<!-- <view class="more flexone">
更多
<img src="../../static/yourow.png" alt="" class="yourow">
</view> -->
</view>
<view class="goodlist">
<view class="goodlistitem flex" v-for="(itemk,indexk) in item.child" :key="indexk" @click="entergood(item)">
<view class="goodlistimg">
<image src="../static/goodlistimg.png" mode=""></image>
</view>
<view class="goodlistright">
<view class="goodrighttop flextwo">
<view class="goodname">{{itemk.name}}</view>
<view class="shareimg">
<image src="../../static/share.png" mode="" class="sharebtn"></image>
<button open-type="share" class="shartype"></button>
</view>
</view>
<view class="zhibo flextwo">
<view class="zhiboleft">{{itemk.anchor.name}}{{itemk.anchor.platform}}</view>
<view class="kaibo">{{itemk.anchor_time.time}}开播</view>
</view>
<view class="zhiboprice">
直播价 ¥<text class="pricege">{{itemk.live_price}}</text>
</view>
<view class="cankao flextwo">
<view class="cankaoleft">参考价(京东¥{{itemk.r_price}}元)</view>
<view v-if='itemk.status_data==1'>
<view v-if="itemk.user_goods==0">
<view class="canlaoright flexone" v-if="itemk.share==true" >
<image src="../../static/naoling.png" mode="" class="naoling"></image>
提醒我
<button open-type="share" class="sharebtnk" v-if="notixing==1" @click.stop="sharefriend(index,indexk,itemk.id,item.share)"></button>
</view>
<view class="canlaoright flexone" v-else @click.stop="tixing(index,indexk,itemk.id)">
<image src="../../static/naoling.png" mode="" class="naoling"></image>
提醒我
</view>
</view>
<view class="canceltixing" v-else @click.stop="canceltixing(index,indexk,itemk.id)">
取消提醒
</view>
</view>
<view v-if="itemk.status_data==2">
<view class="canlaoright flexone">
已上架
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view style="padding: 32rpx;box-sizing: border-box;">
<!-- 这里也有你想要的 -->
<view class="want flextwo">
<view class="wantleft flexone">
<image src="../../static/like.png" mode="" class="likeimg"></image>
也许这里也又你想要的
</view>
</view>
<goodkind :wantlist="wantlist"></goodkind>
</view>
<!-- 弹出层 -->
<view class="register" v-if="noshow" @click="hideding">
<view class="registerwrap">
<view class="title">何时提醒我?</view>
<view class="titletext">在主播开始介绍商品时就提醒您</view>
<view class="title">如何提醒我</view>
<view class="titletext">在你允许消息通知后,届时会给您发送微信消息提醒</view>
<view class='noti flexone' @click="notibtn">
<image src="../static/selectzhong.png" mode="" class="selectxuan" v-if="noti"></image>
<image src="../static/select.png" mode="" class="selectxuan" v-else></image>
不再提示
</view>
<button class="buzai" @click.stop="know" v-if="share==true" open-type="share">我知道了</button>
<view class="buzai" @click.stop="know" v-else>我知道了</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import goodlist from "../../compontent/goodlist.vue"
import goodkind from "../../compontent/goodkind.vue"
import {Toast} from "../../utils/toast.js"
var that
export default {
components: {
goodlist,
goodkind
},
data() {
return {
begin: 1,
hasgood: false,
zhiboid: "",
info: '',
sel: '',
beginlist:[],
page:1,
wantlist:[],
hislist:[],
showpull:true,
notixing:'',
goods_id: '',
noti: false, //提示和不提示按钮
noshow: false, //提示我弹出层
goodindex: '',
goodparindex:'',
share:'',
anchor_time_id:"",
dingyuenum:[]
}
},
onLoad(options) {
this.zhiboid = options.zhiboid;
this.anchor_time_id=options.id
// 获取主播详情
this.getzhibodetail();
this.getbeginlist();
// 获取想要的
this.getwant()
},
onShow() {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
},
onShareAppMessage(res) {
let that = this;
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '早直播',
path:'/pages/xinyuan/zhibodetail?id='+this.zhiboid
}
},
onReachBottom() {
that=this
let newpage=that.page;
newpage++
that.page=newpage;
if(that.showpull==true){
console.log(38493409)
Toast('没有更多了~')
}else{
if(this.begin==1){
that.getbeginlist()
}else{
this.gethislist()
}
}
},
methods: {
// 直播详情
getzhibodetail() {
let that = this;
var url = "anchor/getAnchorInfo"
let param = {
anchor_id: that.zhiboid
}
app.post(url, param, "post").then(res => {
console.log('主播详情', res)
that.info=res
}).catch(err => {
console.log(err)
})
},
// 查看更多
seemore() {
uni.navigateTo({
url: "/pages/xinyuan/zhiboknow"
})
},
beginstart(id) {
this.begin = id;
this.page=1;
this.beginlist=[];
this.hislist=[]
if(id==1){
this.getbeginlist()
}else{
this.gethislist()
}
},
// 全部 今天 明天
select(id) {
this.sel = id;
this.page=1;
this.beginlist=[];
this.getbeginlist()
},
// 订阅直播
dingyuezhi(){
console.log(9999)
let that = this;
var url = "anchor/addUserAnchor"
let param = {
anchor_id: that.zhiboid
}
app.post(url, param, "post").then(res => {
console.log('主播订阅', res)
if(that.info.user_anchor==0){
that.info.user_anchor=1;
uni.showToast({
title:'订阅成功',
icon:'none'
})
}else{
that.info.user_anchor=0;
uni.showToast({
title:'取消订阅成功',
icon:'none'
})
}
that.info=that.info;
that.$forceUpdate()
}).catch(err => {
console.log(err)
})
},
// 获取即将开播
getbeginlist() {
let that = this;
var url = "anchor/getAnchorTimeGoods"
let param = {
anchor_time_id: that.anchor_time_id,
page: that.page,
per_page: 20
}
app.post(url, param, "post").then(res => {
console.log('即将开播', res)
that.beginlist=that.beginlist.concat(res)
if(that.page>1){
if(res.data.length==0){
that.showpull=false
}
}
that.beginlist.forEach(function(value,index,array){
value.child.forEach(function(valuek,indexk,arrayk){
if(valuek.user_goods==1){
if(that.dingyuenum.indexOf(valuek.id)==-1){
that.dingyuenum.push(valuek.id);
that.dingyuenum=that.dingyuenum
}
}
})
})
}).catch(err => {
console.log(err)
})
},
// 你想要的
getwant(){
let that = this;
var url = "category/getRandCategory"
let param={
limit:8
}
app.post(url, param, "post").then(res => {
console.log('我想要的', res)
that.wantlist=res
}).catch(err => {
console.log(err)
})
},
// 订阅消息
tixing(index,indexk,id) {
console.log(99)
let that = this;
if (uni.getStorageSync("token")) {
if (that.notixing == '') {
that.noshow = true
} else {
that.noshow = false
}
that.goodindex = indexk;
that.goodparindex=index;
this.goods_id = id;
// this.dingyue()
wx.getSetting({
// withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.openSetting({ // 打开设置页
success(res) {
console.log(res.authSetting, 88888)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ["XrIccvxDK3IfW3DrnLtKAtKS-pL63BrG3W0Du9l7BrU"], //
success(res) {
// 去订阅
that.dingyue()
}
})
}
}
})
} else {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/mine/mine'
})
}, 1500)
}
},
// 取消订阅
canceltixing(index,indexk, id) {
this.goods_id = id;
this.goodindex = index;
this.goodparindex=indexk;
this.dingyue()
},
// 订阅
dingyue() {
let that = this;
let url = "goods/addUserGoods";
let param = {
goods_id: that.goods_id
}
console.log('参数', param)
app.post(url, param, "post").then(r => {
console.log(r, that.goodindex, '订阅')
let newdingyuenum=that.dingyuenum;
if (that.beginlist[that.goodparindex].child[that.goodindex].user_goods == 0) {
that.beginlist[that.goodparindex].child[that.goodindex].user_goods= 1;
if(newdingyuenum.indexOf(that.beginlist[that.goodparindex].child[that.goodindex].id)==-1){
newdingyuenum.push(that.beginlist[that.goodparindex].child[that.goodindex].id)
}
uni.showToast({
title: '订阅成功',
icon: "none"
})
} else {
that.beginlist[that.goodparindex].child[that.goodindex].user_goods= 0;
newdingyuenum.forEach(function(value,index,array){
if(value==that.beginlist[that.goodparindex].child[that.goodindex].id){
newdingyuenum.splice(index,1)
}
})
uni.showToast({
title: '取消订阅成功',
icon: "none"
})
}
// 直播个数超过10个 显示false
that.beginlist.forEach(function(value,index,array){
value.child.forEach(function(valuek,indexk,arrayk){
if(newdingyuenum.length>=10){
if(valuek.user_goods ==0){
valuek.share=true
}
}else{
if(valuek.user_goods ==0){
valuek.share=false
}
}
})
})
that.beginlist = that.beginlist;
that.$forceUpdate();
}).catch(err => {
console.log(err)
})
},
// 不再提醒
notibtn() {
this.noti = !this.noti;
if (this.noti == true) {
uni.setStorageSync("notixing", 1);
this.notixing=1;
} else {
uni.setStorageSync("notixing", '');
this.notixing=''
}
},
// 我知道了
know() {
this.noshow = false
},
// 取消订阅
hideding() {
this.noshow = false
},
// 分享给好友
sharefriend(index,indexk,id,share) {
console.log(4398489)
let that = this;
if (uni.getStorageSync("token")) {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
if (that.notixing == '') {
that.noshow = true
} else {
that.noshow = false
}
that.goodindex = index;
that.goods_id = id;
that.share=share;
wx.getSetting({
// withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.openSetting({ // 打开设置页
success(res) {
console.log(res.authSetting, 88888)
}
});
} else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ["XrIccvxDK3IfW3DrnLtKAtKS-pL63BrG3W0Du9l7BrU"], //
success(res) {
// 去订阅
that.dingyue()
}
})
}
}
})
} else {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/mine/mine'
})
}, 1500)
}
},
// 进入链接页面
entergood(item){
uni.navigateTo({
url:"/pages/xinyuan/goodlianjie?code="+item.code
})
}
}
}
</script>
<style>
@import url("../../style/xinyuan");
@import url("../../style/goodlist");
page {
background:#fff;
}
.shareimg{
position: relative;
}
.tailzhibo {
font-size: 28rpx
}
.want {
margin-top: 0;
padding-top: 20rpx
}
.zhubokind {
background: #fff;
}
</style>
... ...
<template>
<view class="container">
<view class="searhtoppage flextwo">
<view class="searchtopk flextwo" @click="search">
<image src="../../static/search.png" mode="" class="search"></image>
<view class='searchleft'>
输入您搜索的内容
<!-- <input type="text" placeholder="输入您搜索的内容" /> -->
</view>
</view>
<view class="cancelname">取消</view>
</view>
<view class="swiper_image">
<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration" class="swiper_item_img" @change="swiperChange" :circular="true"
>
<swiper-item v-for="(item,index) in imgUrls" :key="index">
<image :src="item" class="slide-image" mode="aspectFill"/>
</swiper-item>
</swiper>
<view class="dots">
<block v-for="(item,index) in imgUrls" :key="index">
<view class="dot" :class="index == currentSwiper ? ' active' : ''" data-index="index"></view>
</block>
</view>
</view>
<!-- 主播种类 -->
<view class="zhubokind flextwo">
<view class="zhubokinditem">
<view class="zhuboimg">
<image src="../../static/yulan.png" mode=""></image>
<view class='yuanquan'></view>
</view>
<view class="zhubokindname">浏览预告</view>
<view class="setname">设置商品提醒</view>
</view>
<view class="zhubokinditem">
<view class="zhuboimg">
<image src="../../static/intro.png" mode=""></image>
<view class='yuanquan'></view>
</view>
<view class="zhubokindname">主播介绍</view>
<view class="setname">立刻推送提醒</view>
</view>
<view class="zhubokinditem">
<view class="zhuboimg">
<image src="../../static/tixing.png" mode=""></image>
<view class='yuanquan'></view>
</view>
<view class="zhubokindname">收到提醒</view>
<view class="setname">打开软件购买</view>
</view>
</view>
<!-- 主播列表 -->
<view class="zhubolist">
<view class="zhubolistitem flexone" v-for="(item,index) in zhubolist" :key="index" @click="zhubodetail(item.id)">
<view class="zhubohead">
<image :src="item.avatar" mode=""></image>
<view class="zhuboname" >{{item.name}}</view>
</view>
<view class="zhubonamebox">
<view class="zhubonametop flextwo">
<view class="zhubomingzi">最近一场</view>
<view class="zhubodate" v-if="item.anchor_time==null">时间待定</view>
<view class="zhubodate" v-else>{{item.anchor_time.time}}开播</view>
</view>
<view class="zhubotext" v-if="item.anchor_time==null">戳详情订阅TA预告提醒</view>
<view class="zhubotext" v-else>{{item.anchor_time.title}}</view>
<view class="seemore">查看与{{item.name}}有关的一切></view>
</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import {Toast} from "../../utils/toast.js";
var that;
export default {
data() {
return {
index: 0,
indicatorDots: false,
autoplay: true,
interval: 3000,
duration: 500,
currentSwiper: 0,
imgUrls:["1","2"],
page:1,
zhubolist:[],
showpull:true,
}
},
onLoad() {
// 获取主播列表
this.getzhubolist();
// 获取主播banner
this.getbanner()
},
onReachBottom() {
that=this
let newpage=that.page;
newpage++
that.page=newpage;
if(that.showpull==true){
console.log(38493409)
Toast('没有更多了~')
}else{
that.getzhubolist()
}
},
methods: {
swiperChange: function(e) {
this.currentSwiper = e.detail.current
},
// 进入搜索页面
search() {
uni.navigateTo({
url: '/pages/xinyuan/search'
})
},
// 获取banner图
getbanner(){
let that = this;
var url = "anchor/getBanner"
let param={
}
app.post(url, param, "post").then(res => {
console.log('主播banner', res)
that.imgUrls=res;
}).catch(err => {
console.log(err)
})
},
// 获取主播列表
getzhubolist(){
let that = this;
var url = "anchor/getAnchor"
let param={
page:that.page,
per_apge:10
}
app.post(url, param, "post").then(res => {
console.log('主播列表', res)
that.zhubolist=that.zhubolist.concat(res.data);
if(that.page>1){
if(res.data.length==0){
that.showpull=false
}
}
}).catch(err => {
console.log(err)
})
},
// 主播详情
zhubodetail(id){
uni.navigateTo({
url:'/pages/xinyuan/zhibodetail?id='+id
})
}
}
}
</script>
<style>
@import url("../../style/xinyuan");
.searhtoppage{
padding: 0 32rpx;
box-sizing: border-box;
}
/* 轮播图 */
.swiper_image {
width: 688rpx;
height: 256rpx;
font-size: 0;
margin: 80rpx auto 0;
position: relative;
border-radius: 5rpx;
}
swiper {
width: 688rpx;
height: 256rpx;
border-radius: 10rpx;
}
.swiper_image image {
width: 100%;
height: 100%;
border-radius: 20rpx;
}
.swiper_item_img swiper-item {
width: 688rpx;
height: 256rpx;
border-radius: 10rpx;
}
.swiper_item_img swiper-item image {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
swiper-item {
position: relative;
}
swiper-item image {
border-radius: 10rpx;
}
.picimg {
width: 156rpx;
height: 76rpx;
position: absolute;
right: 36rpx;
bottom: 30rpx;
}
.dots {
height: 36rpx;
display: flex;
flex-direction: row;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 10rpx;
}
/*未选中时的小圆点样式 */
.dot {
width: 14rpx;
height: 14rpx;
border-radius: 50%;
margin-right: 16rpx;
background-color: #b9c0f7;
}
/*选中以后的小圆点样式 */
.active {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background-color: #fff;
}
</style>
... ...

832 字节

.goodkind{
flex-wrap: wrap;
margin-top:40rpx
}
.goodkinditem{
display:flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-right:108rpx;
margin-bottom:20rpx
}
.goodkindimg{
width:80rpx;
height: 80rpx;
}
.wantname{
color:#161616;
font-size: 22rpx;
margin-top:16rpx;
text-align: center;
}
.goodkinditem:nth-child(4n){
margin-right: 0;
}
... ...
.goodlist{
margin-top:54rpx
}
.goodlistimg{
width:149rpx;
height: 160rpx;
margin-right:55rpx
}
.shareimg{
width: 48rpx;
height: 48rpx;
background: #ffffff;
border-radius: 24rpx;
box-shadow: 0px 0px 12rpx 0px rgba(126,7,7,0.16);
display:flex;
align-items: center;
justify-content: center;
position: relative;
}
.shartype{
width: 48rpx;
height: 48rpx;
position: absolute;
top:0;
left:0;
border:none;
outline: none;
background:transparent;
}
.shartype::after{
border:none;
outline: none;
background:transparent;
}
.goodlistright{
flex:1
}
.goodname{
color:#0F0F0F;
font-size: 30rpx;
font-weight: bold;
width:336rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.sharebtn{
width:28rpx;
height: 28rpx;
}
.goodlistitem{
padding: 18rpx 0rpx;
box-sizing: border-box;
border-bottom:1rpx solid #F5F5F5
}
.zhibo{
flex:1;
margin-top:10rpx
}
.zhiboleft{
padding:2rpx 8rpx;
box-sizing: border-box;
background: #ffffff;
border: 2px solid #ffb974;
border-radius: 4rpx;
color:#FFB974;
font-size:20rpx
}
.kaibo{
color:#A0A0A0;
font-size:22rpx
}
.zhiboprice{
color:#FF0000;
font-size:22rpx;
margin-top:38rpx
}
.pricege{
color:#FF0000;
font-size:30rpx;
font-weight: bold;
}
.canlaoright{
width: 144rpx;
height: 48rpx;
background: linear-gradient(85deg,#ff5d8e 8%, #ff8172 97%);
border-radius: 10rpx;
color:#fff;
font-size: 24rpx;
display:flex;
justify-content: center;
align-items: center;
position: relative;
}
.sharebtnk{
width: 144rpx;
height: 48rpx;
position: absolute;
left:0;
top:0
}
.canceltixing{
width: 144rpx;
height: 48rpx;
background: #bbbbbb;
border-radius: 10rpx;
color:#fff;
font-size:24rpx;
text-align:center;
line-height: 48rpx;
}
.cankao{
margin-top:12rpx
}
.cankaoleft{
color:#999999;
font-size:22rpx
}
.naoling{
width:22rpx;
height: 22rpx;
margin-right:10rpx
}
.wantleft{
}
.likeimg{
width:32rpx;
height: 32rpx;
margin-right: 16rpx;
}
button{
border:none;
outline: none;
background: transparent;
}
button::after{
border:none;
outline: none;
}
.registerwrap {
width: 560rpx;
height: 620rpx;
background: #fff;
border-radius: 20rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 42rpx 32rpx 32rpx;
box-sizing: border-box;
}
.title {
color: #333;
font-size: 32rpx;
font-weight: bold;
text-align: center;
margin-bottom: 40rpx
}
.titletext {
color: #333;
font-size: 28rpx;
margin-bottom: 40rpx;
}
.selectxuan {
width: 30rpx;
height: 30rpx;
margin-right: 20rpx;
}
.noti {
color: #333;
font-size: 28rpx
}
.buzai {
width: 368rpx;
height: 64rpx;
background: #ff5d8e;
border-radius: 32rpx;
color: #fff;
font-size: 28rpx;
text-align: center;
line-height: 64rpx;
margin: 40rpx auto 0;
}
\ No newline at end of file
... ...