作者 lihongjuan

提交

要显示太多修改。

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

... ... @@ -2,28 +2,97 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>tangyuan</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=0" />
<title></title>
<style></style>
</head>
<body>
<body class="calbox">
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<script>
// 尺寸计算
function setFontSize() {
document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
};
document.documentElement.style.fontSize =
document.documentElement.clientWidth / 7.5 + "px";
}
window.addEventListener('resize', function() {
window.addEventListener(
"resize",
function() {
setFontSize();
},
false
);
setFontSize();
}, false);
// var isScroll_top = true;
// var ua = navigator.userAgent.toLowerCase();
// //系统判断
// if (ua.match(/iPhone/i) == "iphone") {
// //滚动条是否在底部
// var isScrill_bottom = false;
// function restoreEvent(event) {
// switch (event.type) {
// case "touchstart":
// $startY = event.touches[0].clientY;
// break;
// case "touchmove":
// $moveY = event.touches[0].clientY;
// //滑动距离
// touchesY = $startY - $moveY;
// //滚动条顶部
// if (isScroll_top) {
// if (touchesY < 0) {
// event.preventDefault();
// } else {
// var scrollWrap = document.getElementById("app");
// if (scrollWrap.scrollHeight == scrollWrap.clientHeight) {
// event.preventDefault();
// } else {
// event.stopPropagation();
// }
// }
// //滚动条底部
// } else if (isScrill_bottom) {
// if (touchesY > 0) {
// event.preventDefault();
// } else {
// event.stopPropagation();
// }
// }
// break;
// case "touchend":
// break;
// }
// }
// document
// .getElementById("app")
// .addEventListener("touchstart", restoreEvent);
// document
// .getElementById("app")
// .addEventListener("touchmove", restoreEvent);
// document.getElementById("app").addEventListener("touchend", restoreEvent);
// document.getElementById("app").addEventListener("scroll", function() {
// var tabView = document.getElementById("app");
// var contentHeight = tabView.scrollHeight, //内容高度
// scrollTop = tabView.scrollTop; //滚动高度
// viewHeight = tabView.clientHeight;
setFontSize();
// if (scrollTop == 0) {
// isScroll_top = true;
// } else {
// isScroll_top = false;
// }
// if (scrollTop / (contentHeight - viewHeight) == 1) {
// isScrill_bottom = true;
// } else {
// isScrill_bottom = false;
// }
// });
// }
</script>
</html>
\ No newline at end of file
... ...
... ... @@ -6498,6 +6498,11 @@
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
"dev": true
},
"ios-scroll-supply": {
"version": "1.0.6",
"resolved": "https://registry.npm.taobao.org/ios-scroll-supply/download/ios-scroll-supply-1.0.6.tgz",
"integrity": "sha1-Odt5BkaKh3q2GqA2INY5vYkX9Bk="
},
"ip": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/ip/download/ip-1.0.1.tgz",
... ... @@ -7558,6 +7563,11 @@
"verror": "1.10.0"
}
},
"jweixin-1.6.0": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/jweixin-1.6.0/download/jweixin-1.6.0-1.0.0.tgz",
"integrity": "sha1-1l7FPnOKlbXFTNX0Kj808OguKdU="
},
"killable": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/killable/download/killable-1.0.1.tgz",
... ... @@ -8328,6 +8338,22 @@
"run-queue": "^1.0.3"
}
},
"mpvue-calendar": {
"version": "2.3.7",
"resolved": "https://registry.npm.taobao.org/mpvue-calendar/download/mpvue-calendar-2.3.7.tgz",
"integrity": "sha1-c/fyJalOiAMmtsxLm+Bo3phNCeE=",
"requires": {
"core-js": "^3.4.4",
"vue": "^2.6.10"
},
"dependencies": {
"core-js": {
"version": "3.6.5",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-3.6.5.tgz",
"integrity": "sha1-c5XcJzrzf7LlDpvT2f6EEoUjHRo="
}
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz",
... ... @@ -14249,6 +14275,11 @@
"resolved": "https://registry.npm.taobao.org/vue/download/vue-2.6.11.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue%2Fdownload%2Fvue-2.6.11.tgz",
"integrity": "sha1-dllNh31LEiNEBuhONSdcbVFBJcU="
},
"vue-calendar-component": {
"version": "2.8.2",
"resolved": "https://registry.npm.taobao.org/vue-calendar-component/download/vue-calendar-component-2.8.2.tgz",
"integrity": "sha1-j2DAWnLIqsvdIkAW9OGpZmSr2Ko="
},
"vue-clipboard2": {
"version": "0.3.1",
"resolved": "https://registry.npm.taobao.org/vue-clipboard2/download/vue-clipboard2-0.3.1.tgz",
... ... @@ -15694,7 +15725,8 @@
"weixin-js-sdk": {
"version": "1.6.0",
"resolved": "https://registry.npm.taobao.org/weixin-js-sdk/download/weixin-js-sdk-1.6.0.tgz",
"integrity": "sha1-/1BITYEYzhII8RJIz0ocCDFXdRQ="
"integrity": "sha1-/1BITYEYzhII8RJIz0ocCDFXdRQ=",
"dev": true
},
"whatwg-encoding": {
"version": "1.0.5",
... ...
... ... @@ -15,11 +15,14 @@
"dependencies": {
"axios": "^0.19.2",
"clipboard": "^2.0.6",
"ios-scroll-supply": "^1.0.6",
"jweixin-1.6.0": "^1.0.0",
"mpvue-calendar": "^2.3.7",
"vant": "^2.9.2",
"vue": "^2.5.2",
"vue-calendar-component": "^2.8.2",
"vue-clipboard2": "^0.3.1",
"vue-router": "^3.0.1",
"weixin-js-sdk": "^1.6.0"
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
... ... @@ -67,7 +70,8 @@
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
"webpack-merge": "^4.1.0",
"weixin-js-sdk": "^1.6.0"
},
"engines": {
"node": ">= 6.0.0",
... ...
<script>
let url = location.href.split("?");
let params = url[1].split("&");
let data = {};
params.forEach((n, i) => {
let p = n.split("=");
data[p[0]] = p[1];
});
if (!!data.shareRedirect) {
alert(decodeURIComponent(data.shareRedirect));
window.location.href = decodeURIComponent(data.shareRedirect);
}
</script>
\ No newline at end of file
... ...
... ... @@ -6,9 +6,8 @@
<script>
export default {
name: 'App'
}
name: "App"
};
</script>
<style>
... ... @@ -18,14 +17,15 @@ export default {
.van-list__loading {
width: 100% !important;
}
body,
html {
overflow-x: hidden;
overflow: touch;
}
#app {
width: 100%;
height: 100%;
}
.nodata {
color: #999;
font-size: 0.28rem;
... ... @@ -42,6 +42,7 @@ html {
padding: 0;
margin: 0;
background: #f9f9f9;
overflow-y: scroll;
}
img {
width: 100%;
... ... @@ -80,6 +81,10 @@ textarea {
padding: 0.2rem 0.32rem;
box-sizing: border-box;
background: #fff;
position: fixed;
top: 0;
left: 0;
z-index: 99;
}
.searchimg {
width: 0.3rem;
... ... @@ -279,6 +284,22 @@ input {
top: 0;
left: 0;
}
.sharetopk {
width: 100%;
padding: 0.18rem 0.32rem;
box-sizing: border-box;
background: #fff;
position: fixed;
top: 0;
left: 0;
z-index: 99;
}
.sharetopkk {
width: 100%;
padding: 0.18rem 0.32rem;
box-sizing: border-box;
background: #fff;
}
.leftrow {
width: 0.44rem;
height: 0.44rem;
... ... @@ -294,4 +315,152 @@ input {
height: 0.34rem;
font-size: 0;
}
.fanbanck {
width: 100%;
background: #759875;
padding: 0.18rem 0.32rem;
box-sizing: border-box;
color: #fff;
margin-bottom: 0.38rem;
position: fixed;
top: 0;
left: 0;
z-index: 99;
}
.topk {
color: #fff;
font-size: 0.34rem;
}
.leftrowkimg {
width: 0.35rem;
height: 0.3rem;
}
.calendarbox .van-overlay {
display: none;
position: unset;
}
.van-overflow-hidden {
overflow: auto !important;
overflow-y: scroll;
}
.van-calendar__day {
height: 41px !important;
}
.van-calendar__popup.van-popup--bottom,
.van-calendar__popup.van-popup--top {
height: 62%;
}
.calendarbox .van-icon {
display: none !important;
}
/* .changeitemright .van-image {
width: 1rem;
height: 1rem;
font-size: 0;
}
.calendarbox .changeitem {
margin-right: 8px;
} */
/* .van-popup--bottom {
top: 0;
left: 0;
} */
.calendarbox {
width: 100%;
height: 7rem;
/* position: fixed;
top: 0;
left: 0; */
}
.van-overflow-hidden {
position: unset;
}
.wh_content_all {
background: #fff !important;
}
.wh_top_changge li {
color: #333 !important;
}
.wh_jiantou1[data-v-2ebcbc83] {
width: 10px !important;
height: 10px !important;
border-top: 1px solid #333 !important;
border-left: 1px solid #333 !important;
transform: rotate(-45deg);
}
.wh_jiantou2[data-v-2ebcbc83] {
width: 10px !important;
height: 10px !important;
border-top: 1px solid #333 !important;
border-right: 1px solid #333 !important;
transform: rotate(45deg);
}
.wh_top_tag {
color: #333 !important;
}
.wh_content_item {
color: #333 !important;
}
.wh_content_item .wh_isToday {
background: #87bd87 !important;
color: #fff !important;
}
.wh_content_item > .wh_isMark {
background: #4a834a !important;
color: #fff !important;
}
.wh_content_item .wh_chose_day {
background: #fff !important;
}
.wh_content_item .wh_isToday {
/* color: #333 !important; */
}
.mpvue-calendar td.selected span {
background-color: #4a834a !important;
color: #fff;
border-radius: 50%;
}
.mpvue-calendar {
min-width: 100% !important;
}
.mc-head .mc-head {
width: 100% !important;
}
.mc-body {
width: 100% !important;
}
.yuandian {
position: relative;
}
.yuandian::after {
display: block;
content: "";
width: 0.1rem;
height: 0.1rem;
border-radius: 50%;
background: #ea6151;
position: absolute;
top: 0;
left: 60%;
z-index: 999;
/* transform: translateX(-50%); */
}
.zuixin {
background: #759875;
}
.newacty {
color: #fff;
}
.mpvue-calendar td.yuandian span {
/* background: #ea2c43; */
/* color: #fff; */
}
.mpvue-calendar td.yuandian .mc-text {
color: #fff;
}
/* .mpvue-calendar .yuandian span {
} */
</style>
... ...
<template>
<div class="container">
<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
<van-swipe-item>
<div>
<img src="../../../assets/Group Copy@2x.png" alt />
</div>
</van-swipe-item>
<van-swipe-item>
<div>
<img src="../../../assets/Group Copy@2x.png" alt />
</div>
</van-swipe-item>
<van-swipe-item>
<div>
<img src="../../../assets/Group Copy@2x.png" alt />
</div>
</van-swipe-item>
<van-swipe-item>
<div>
<img src="../../../assets/Group Copy@2x.png" alt />
<van-swipe-item v-for="(item, index) in banner" :key="index" @click="bannerdetail(item)">
<div class="itemimg">
<img :src="item.image" alt />
</div>
</van-swipe-item>
</van-swipe>
<div class="monthimg" @click="showcalendar">
<img src="../../../assets/sanyue.png" alt />
<div class="seeactivity">
<img :src="calendar" alt />
<!-- <div class="seeactivity">
<img src="../../../assets/seehuodong.png" alt />
</div>-->
</div>
<div>
<div
class="spring"
v-for="(item,index) in activilist"
:key="index"
@click="godetail(item.id)"
>
<img :src="item.image" alt />
</div>
<div class="spring">
<img src="../../../assets/come.png" alt />
</div>
<div class="spring">
<img src="../../../assets/spring.png" alt />
</div>
<!-- <div class="spring" v-if="banner.length > 1" @click="godetail(banner[1].id)">
<img :src="banner[1].image" alt />
</div>-->
<van-calendar v-model="show" @confirm="onConfirm" />
<tabBar v-bind:active="2" />
</div>
</template>
<script>
import Vue from 'vue';
import { Swipe, SwipeItem } from 'vant';
import Vue from "vue";
import { Swipe, SwipeItem } from "vant";
import { Calendar } from 'vant';
import { Calendar } from "vant";
Vue.use(Calendar);
Vue.use(Swipe);
Vue.use(SwipeItem);
... ... @@ -58,13 +50,60 @@ export default {
data() {
return {
selnav: 2,
date: '',
date: "",
show: false,
calendar: "",
banner: [],
activilist: []
};
},
created() {
document.title = "唐元集活动中心";
this.getactivity();
},
methods: {
godetail(id) {
this.$router.push({
path: "/activitydetail",
query: {
id: id
}
});
},
bannerdetail(item) {
this.$router.push({
path: "/activitydetail",
query: {
id: item.id
}
});
},
// 获取活动
getactivity() {
let that = this;
var url = "/api/activity/activity_list";
let param = {
date: ""
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.calendar = res.data.calendar;
that.banner = res.data.activity;
that.activilist = res.data.activity_time
console.log(that.banner);
})
.catch(function (err) {
console.log(err);
});
},
showcalendar() {
this.show = true
this.$router.push({
path: "/activitycalendar"
});
// this.show = true
},
selcourse(e) {
console.log(37344);
... ... @@ -78,14 +117,21 @@ export default {
onConfirm(date) {
this.show = false;
this.date = this.formatDate(date);
},
}
}
};
</script>
<style scoped>
@import "../../../style/activity.css";
.container{
.container {
padding-bottom: 1.2rem;
}
.itemimg {
height: 3.2rem;
}
.itemimg img {
width: 100%;
height: 100%;
}
</style>
... ...
<template>
<div class="container">
<div class="flextwo sharetopkk" @click="back" style="position: fixed;top:0;left:0;">
<div class="leftrow leftrowkimg">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">活动日历</div>
<div class="sharebtn">
<!-- <img src="../../../assets/sharebtn.png" alt /> -->
</div>
</div>
<div class="datePicker" ref="element">
<!-- :begin="begin"
:end="end"-->
<!-- :monthRange="monthRange" -->
<!-- :value="value" -->
<Calendar
id="cal"
:months="months"
:now="false"
:responsive="false"
lunar
clean
@select="selected"
@prev="prev"
@next="next"
:multi="false"
ref="calendar"
/>
</div>
<div class="actlist van-overflow-hidden" :style="{'margin-top':gaodu}">
<div class="activitytext" v-html="activity_des"></div>
<div class="actsecbox">
<div class="spring" v-for="(item, index) in banner" :key="index" @click="actdetail(item)">
<img :src="item.image" alt />
</div>
</div>
</div>
</div>
</template>
<script>
import Calendar from "mpvue-calendar";
import "mpvue-calendar/src/browser-style.css";
// import util from "../../util/util";
export default {
components: {
Calendar
},
data() {
return {
months: [
"1月 ",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月"
],
// value: [2020, 8, 20],
chuandate: "",
chaundatedate: "",
banner: [],
showyear: '',
showmonth: '',
currentmonth: '',
selectday: '',
today: false,
activity_des: '',
gaodu: ""
// disabledArray: ['2018-6-27','2018-6-25'],
// value: util.formatDate(Date.parse(new Date())),
// begin: util.formatDate(Date.parse(new Date())),
// end: util.formatDate(Date.parse(new Date()) + 90 * 24 * 60 * 60 * 1000) //假设未来20天可以选择日期
// monthRange: ["2019-6", "2019-8"]
// events: {'2018-6-7':'今日备注', '2018-6-8':'一条很长的明日备注'},自定义备注
// almanacs: {'9-3': '抗战胜利日', '11-17': '学生日'},//自定义节日
// tileContent: [
// {date: '2018-9-22', className: 'holiday ', content: '休'},
// {date: '2018-9-23', className: 'holiday ', content: '休'}
// ],//为每个具体日期自定义class和插入文本内容,具体用法见下
};
},
created() {
document.title = "唐元集公众号";
// this.id = this.$route.query.id;
// console.log(this.id);
let that = this;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
let day = date.getDate();
if (day < 10) {
day = "0" + day;
}
let datek = year + "-" + month;
let datekk = year + "-" + month + "-" + day;
this.chuandate = datek;
this.chaundatedate = datekk;
this.showyear = year;
this.showmonth = month;
this.currentmonth = year + '-' + month
console.log(that.chuandate);
this.getact();
// 获取某一个月的活动
this.getmonthactive()
this.$nextTick(function () {
var len = that.$refs.element.offsetHeight + 40 + 'px';
that.gaodu = len;
console.log(that.gaodu)
})
},
mounted() { },
methods: {
back() {
this.$router.go(-1)
},
prev(year, month, weekIndex) {
let that = this;
console.log(year, month, weekIndex);
if (month < 10) {
month = '0' + month
}
this.selectday = ''
this.showyear = year;
this.showmonth = month
this.chuandate = year + '-' + month;
this.getact()
this.getmonthactive()
this.$nextTick(function () {
var len = that.$refs.element.offsetHeight + 40 + 'px';
that.gaodu = len;
console.log(that.gaodu)
})
},
next(year, month, weekIndex) {
let that = this;
console.log(year, month, weekIndex);
if (month < 10) {
month = '0' + month
}
this.selectday = ''
this.showyear = year;
this.showmonth = month
this.chuandate = year + '-' + month;
this.getact()
this.getmonthactive();
this.$nextTick(function () {
var len = that.$refs.element.offsetHeight + 40 + 'px';
that.gaodu = len;
console.log(that.gaodu)
})
},
// 获取某一个月的活动
getmonthactive() {
let that = this;
var url = "/api/activity/activity_list";
let param = {
date: that.chuandate
};
that.$axios
.post(url, param)
.then(function (res) {
that.banner = res.data.activity;
that.activity_des = res.data.activity_des
})
.catch(function (err) {
console.log(err);
});
},
// 渲染哪一天有活动
getact() {
let that = this;
var url = "/api/activity/activity_list";
let param = {
date: that.chuandate
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
let datearr = res.data.date;
if (datearr.indexOf(that.selectday) == -1) {
that.today = true
}
console.log(that.today)
if (that.selectday != '') {
datearr.push(that.selectday)
}
console.log(datearr)
// 显示有活动的天数
that.$nextTick(() => {
let monthArray = document.getElementsByClassName("lunarStyle");
if (datearr.length != 0) {
for (var i = 0; i < monthArray.length; i++) {
// 先清除选中的天数
monthArray[i].classList.remove('selected');
monthArray[i].classList.remove('yuandian');
for (var j = 0; j < datearr.length; j++) {
let day = "";
let showdate = ''
let date = monthArray[i].innerText.split("");
if (date.length == 5) {
day = date[0] + date[1];
} else if (date.length == 4) {
day = + date[0];
}
// showdate = that.showyear + '/' + that.showmonth + '/' + day;
if (monthArray[i].classList.contains('disabled') == false) {
if (day == datearr[j]) {
monthArray[i].setAttribute("class", "yuandian lunarStyle");
if (that.today == true) {
console.log(that.selectday)
if (datearr[j] == that.selectday) {
console.log(8888)
monthArray[i].setAttribute("class", "selected lunarStyle");
}
}
}
}
}
}
} else {
for (var i = 0; i < monthArray.length; i++) {
// 先清除选中的天数
monthArray[i].classList.remove('yuandian');
monthArray[i].classList.remove('selected');
}
}
});
// that.selectday = ''
// that.banner = res.data.activity;
})
.catch(function (err) {
console.log(err);
});
},
// 获取某一天的活动
getdayactive() {
let that = this;
var url = "/api/activity/activity_list";
let param = {
date_detail: that.chaundatedate
};
that.$axios
.post(url, param)
.then(function (res) {
that.banner = res.data.activity;
})
.catch(function (err) {
console.log(err);
});
},
// 琥珀去
// selectYear(year) {
// console.log(year)
// },
// selectMonth(month, year) {
// console.log(year, month)
// },
// setToday() {
// this.$refs.calendar.setToday()
// },
// dateInfo() {
// const info = this.$refs.calendar.dateInfo(2018, 8, 23)
// console.log(info);
// },
// renderer() {
// this.$refs.calendar.renderer(2018, 8); //渲染2018年8月份
// },
selected(val, val2) {
console.log(this);
let monthArray = this.$refs.calendar.monthRangeDays;
console.log(monthArray);
console.log(val);
this.selectday = val[2]
if (val[1] < 10) {
val[1] = '0' + val[1]
}
if (val[2] < 10) {
val[2] = '0' + val[2]
}
this.chaundatedate = val[0] + '-' + val[1] + '-' + val[2];
this.getdayactive()
this.getact()
console.log(this.chaundatedate)
console.log(val2);
},
// 去活动详情页
actdetail(item) {
this.$router.push({
path: "/activitydetail",
query: {
id: item.id
}
});
}
}
};
</script>
<style scoped>
.activitytext {
}
.datePicker {
width: 100%;
position: fixed;
top: 0.8rem;
left: 0;
}
.active {
height: auto !important;
}
#app {
height: auto !important;
}
.container {
height: 100%;
}
/* @import "../../../style/activity.css"; */
.actlist {
margin-top: 9.6rem;
}
.activitytext {
color: #454e56;
font-size: 0.28rem;
padding: 0 0.32rem 0;
box-sizing: border-box;
}
.spring {
width: 6.86rem;
height: 2.88rem;
margin: 0 auto 0.32rem;
}
.calendarbox {
position: relative;
}
.calendarfixed {
width: 100%;
height: 5.5rem;
position: absolute;
top: 1rem;
left: 0;
background: transparent;
}
.acttop {
position: fixed;
top: 0;
left: 0;
background: #fff;
}
</style>
... ...
<template>
<div class="container">
<div class="flextwo sharetopk" @click="back">
<div class="leftrow leftrowkimg">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">活动详情</div>
<div class="sharebtn" @click.stop="collectis">
<img src="../../../assets/star.png" alt v-if="collect" />
<img src="../../../assets/nostar.png" alt v-else />
</div>
</div>
<div class="detailbox">
<div class="detailtitle">{{ title }}</div>
<div class="actdetail" v-html="content"></div>
</div>
</div>
</template>
<script>
import { Toast } from "vant";
export default {
data() {
return {
id: "",
content: "",
title: "",
collect: false
};
},
created() {
document.title = "唐元集公众号";
this.id = this.$route.query.id;
console.log(this.id);
this.getdetail();
},
methods: {
back() {
this.$router.go(-1);
},
collectis() {
let that = this;
var url = "/api/user/favorite";
let param = {
type: 2,
favorite_id: that.id
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
if (that.collect == false) {
that.collect = true;
Toast("收藏成功");
} else {
that.collect = false;
Toast("取消收藏成功");
}
})
.catch(function (err) {
console.log(err);
});
},
getdetail() {
let that = this;
var url = "/api/activity/detail";
let param = {
activity_id: that.id
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.content = res.data.activity.content;
that.title = res.data.activity.title;
if (res.data.activity.is_favorite == 1) {
that.collect = true;
} else {
that.collect = false;
}
})
.catch(function (err) {
console.log(err);
});
}
}
};
</script>
<style scoped>
.detailtitle {
color: #344039;
font-size: 0.4rem;
}
.actdetail {
font-size: 0.32rem;
margin-top: 0.32rem;
}
.detailbox {
padding: 0.32rem;
box-sizing: border-box;
margin-top: 0.8rem;
}
</style>
... ...
<template>
<div class="container">
<div class="calendarbox">
<van-calendar
v-model="show"
@select="selectdate"
@confirm="onConfirm"
position="top"
color="#87BD87"
:default-date="datemo"
type="multiple"
:show-confirm="false"
title="活动日历"
/>
</div>
<div class="actlist van-overflow-hidden">
<div class="actsecbox">
<div class="spring" v-for="(item, index) in banner" :key="index" @click="actdetail(item)">
<img :src="item.image" alt />
</div>
</div>
</div>
<tabBar v-bind:active="2" />
</div>
</template>
<script>
import Vue from "vue";
import { Swipe, SwipeItem } from "vant";
import { Calendar } from "vant";
Vue.use(Calendar);
Vue.use(Swipe);
Vue.use(SwipeItem);
import tabBar from "@/components/views/tabBar.vue";
export default {
components: {
tabBar
},
data() {
return {
selnav: 2,
date: "",
show: true,
chuandate: "",
banner: [],
datemo: "",
type: "multiple"
};
},
created() {
document.title = "唐元集公众号";
let that = this;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
let day = date.getDate();
if (day < 10) {
day = "0" + day;
}
let datek = year + "-" + month;
this.chuandate = datek;
console.log(datek);
that.getact();
},
methods: {
showcalendar() {
this.show = true;
},
actdetail(item) {
this.$router.push({
path: "/activitydetail",
query: {
id: item.id
}
});
},
selcourse(e) {
console.log(e);
this.selnav = e.currentTarget.dataset.id;
},
//日历
formatDate(date) {
return `${date.getMonth() + 1}/${date.getDate()}`;
},
getact() {
let that = this;
var url = "/api/activity/activity_list";
let param = {
date: that.chuandate
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.banner = res.data.activity;
let date = res.data.date;
console.log(date);
let arr = [];
date.forEach(function (value, index, array) {
if (value[1] < 10) {
value[1] = "0" + Number(value[1] - 1).toString();
} else {
value[1] = Number(value[1] - 1).toString();
}
arr.push(new Date(value[0], value[1], value[2]));
that.datemo = arr;
});
})
.catch(function (err) {
console.log(err);
});
},
getactsec() {
let that = this;
var url = "/api/activity/activity_list";
let param = {
date: that.chuandate
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.banner = res.data.activity;
})
.catch(function (err) {
console.log(err);
});
},
selectdate(date) {
let that = this;
let len = date.length;
len = len - 1;
console.log(date);
let year = date[len].getFullYear();
let month = date[len].getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
let day = date[len].getDate();
if (day < 10) {
day = "0" + day;
}
let datek = year + "-" + month;
this.chuandate = datek;
console.log(datek);
that.getactsec();
},
onConfirm(date) {
let that = this;
console.log(date);
let len = date.length;
len = len - 1;
let year = date[len].getFullYear();
let month = date[len].getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
let day = date[len].getDate();
if (day < 10) {
day = "0" + day;
}
let datek = year + "-" + month;
this.chuandate = datek;
console.log(datek);
that.getactsec();
}
}
};
</script>
<style scoped>
@import "../../../style/activity.css";
body {
overflow: scroll;
}
.van-overlay {
position: unset !important;
}
.container {
padding-bottom: 1.2rem;
height: 100%;
overflow-y: scroll;
display: flex;
flex-direction: column;
width: 100%;
}
/* .actlist {
position: fixed;
top: 10.2rem;
left: 0;
z-index: 999;
}
.actsecbox {
position: relative;
height: 10rem;
overflow-y: scroll;
} */
.actlist {
flex: 1;
/* height: 10rem; */
margin-top: 0.8rem;
overflow-y: scroll;
}
.calendarbox .van-overlay {
display: none;
}
.van-overflow-hidden {
overflow: auto !important;
}
.calendarbox .van-overlay .van-calendar__day {
height: 41px !important;
}
.van-calendar__popup.van-popup--bottom,
.van-calendar__popup.van-popup--top {
height: 62%;
}
.van-icon {
display: none !important;
}
</style>
... ...
<template>
<div class="containerbox">
<van-calendar v-model="show" @confirm="onConfirm" />
<div class="container" id="app">
<div class="acttop">
<div class="flextwo sharetopkk" @click="back">
<div class="leftrow leftrowkimg">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">活动日历</div>
<div class="sharebtn">
<!-- <img src="../../../assets/sharebtn.png" alt /> -->
</div>
</div>
<div class="calendarbox">
<Calendar ref="Calendar" :markDate="arr2" v-on:changeMonth="changeDate"></Calendar>
<div class="calendarfixed"></div>
</div>
</div>
<div class="actlist van-overflow-hidden">
<div class="actsecbox">
<div class="spring" v-for="(item, index) in banner" :key="index" @click="actdetail(item)">
<img :src="item.image" alt />
</div>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { Calendar } from 'vant';
import Calendar from "vue-calendar-component";
Vue.use(Calendar);
export default {
components: {
Calendar
},
data() {
return {
date: '',
show: false,
arr2: ["2020/8/15", "2019/4/3", "2019/4/4"],
banner: [],
chuandate: ""
};
},
created() {
document.title = "唐元集公众号";
this.id = this.$route.query.id;
console.log(this.id);
document.title = "唐元集公众号";
let that = this;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
let day = date.getDate();
if (day < 10) {
day = "0" + day;
}
let datek = year + "-" + month;
this.chuandate = datek;
this.getact();
},
methods: {
formatDate(date) {
return `${date.getMonth() + 1}/${date.getDate()}`;
changeDate(data) {
console.log(data); //左右点击切换月份
var date1 = data;
date1 = date1.split("/");
if (date1[1] < 10) {
date1[1] = "0" + date1[1];
}
date1 = date1[0] + "-" + date1[1];
console.log(date1);
this.chuandate = date1;
this.getact();
},
onConfirm(date) {
this.show = false;
this.date = this.formatDate(date);
back() {
this.$router.go(-1);
},
getact() {
let that = this;
var url = "/api/activity/activity_list";
let param = {
date: that.chuandate
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.banner = res.data.activity;
that.arr2 = res.data.date_arr;
let date = res.data.date;
console.log(date);
let arr = [];
date.forEach(function (value, index, array) {
if (value[1] < 10) {
value[1] = "0" + Number(value[1] - 1).toString();
} else {
value[1] = Number(value[1] - 1).toString();
}
}
arr.push(new Date(value[0], value[1], value[2]));
that.datemo = arr;
});
})
.catch(function (err) {
console.log(err);
});
},
actdetail(item) {
this.$router.push({
path: "/activitydetail",
query: {
id: item.id
}
});
}
}
};
</script>
<style>
<style scoped>
.active {
height: auto !important;
}
#app {
height: auto !important;
}
.container {
height: 100%;
}
/* @import "../../../style/activity.css"; */
.actlist {
margin-top: 8.2rem;
}
.spring {
width: 6.86rem;
height: 2.88rem;
margin: 0 auto 0.32rem;
}
.calendarbox {
position: relative;
}
.calendarfixed {
width: 100%;
height: 5.5rem;
position: absolute;
top: 1rem;
left: 0;
background: transparent;
}
.acttop {
position: fixed;
top: 0;
left: 0;
background: #fff;
}
</style>
... ...
... ... @@ -11,22 +11,24 @@
type="text"
placeholder="搜索你感兴趣的课程文章"
class="searchtext"
@click="entersearch"
/>
</div>
</div>
<!-- 课程列表 -->
<div class="courseitem flex">
<div class="courseitemk">
<div class="courseitem flex" v-if="now != null" @click="zhibodetail(now)">
<div class="courseimg">
<img src="../../../assets/courseimg.png" alt />
<img :src="now.image" alt />
</div>
<div class="courseright">
<div class="coursetitle">关于减肥,除了科学运动</div>
<div class="zhibo flexone">
<div class="coursetitlek">{{ now.title }}</div>
<div class="zhibok flexone">
<img src="../../../assets/zhibo.png" alt class="zhiimg" />
<div class="zhiname">正在直播</div>
</div>
<div class="know flexone">
<span class="morepeople">很多人不能正确理解减肥</span>
<span class="morepeople">{{ now.description }}</span>
<div class="knowmore">
了解详情
<img src="../../../assets/yourow.png" alt class="yourow" />
... ... @@ -34,18 +36,22 @@
</div>
</div>
</div>
<div class="courseitem flex">
<div
class="courseitem flex"
v-if="next != null"
@click="zhibodetail(next)"
>
<div class="courseimg">
<img src="../../../assets/courseimg.png" alt />
<img :src="next.image" alt />
</div>
<div class="courseright">
<div class="coursetitle">关于减肥,除了科学运动</div>
<div class="zhibo flexone">
<div class="coursetitlek">{{ next.title }}</div>
<div class="zhibok flexone">
<img src="../../../assets/ready.png" alt class="zhiimg" />
<div class="zhiname">正在直播</div>
<div class="zhiname">{{ next.start_time }}准时开课</div>
</div>
<div class="know flexone">
<span class="morepeople">很多人不能正确理解减肥</span>
<span class="morepeople">{{ next.description }}</span>
<div class="knowmore">
了解详情
<img src="../../../assets/yourow.png" alt class="yourow" />
... ... @@ -53,16 +59,17 @@
</div>
</div>
</div>
</div>
<!-- 课程头部 -->
<div class="coursenav flexone">
<div class="coursenavkkk flexone">
<div
class="coursenavleft"
:class="selnav == 0 ? 'selactive' : ''"
:data-id="0"
@click="selectnav"
>
音频课程
唐元集课程
</div>
<div
class="coursenavleft"
... ... @@ -73,25 +80,45 @@
营养小知识
</div>
</div>
<div class="coursetop" v-if="selnav == 0">
<div class="coursenavleftkk flexone">
<div
class="coursenavleftk"
:class="navindex == index ? 'selactive' : ''"
@click="selectnavsec(item.id, index)"
v-for="(item, index) in cursekindlist"
:key="index"
>
{{ item.name }}
</div>
</div>
</div>
<!-- <img src="../../../assets/youhua.png" class="youhua" alt /> -->
<!-- 课程 -->
<div v-if="selnav == 0">
<div class="nodata" v-if="videolist.length == 0">暂无数据</div>
<van-list
class="courseboxk"
class="courseboxkkk"
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
v-else
>
<div class="courseboxitem" v-for="item in videolist" :key="item">
<div
class="courseboxitem"
v-for="(item, index) in videolist"
:key="index"
@click="coursedetail(item)"
>
<div class="coursenameimg">
<img :src="item.image" alt />
</div>
<div class="coursetext">
<div class="coursetitle">{{ item.title }}</div>
<div class="coursetitlek">{{ item.title }}</div>
<div class="coursename">{{ item.description }}</div>
<div class="courseteacher">{{ item.user.nickname }}</div>
<div class="courseteacher">讲师:{{ item.user.nickname }}</div>
</div>
</div>
</van-list>
... ... @@ -118,13 +145,12 @@
<img :src="item.image" alt />
</div>
<div class="coursetext">
<div class="coursename knowlagename" v-html="item.content"></div>
<div class="coursename knowlagename">{{ item.title }}</div>
</div>
</div>
</van-list>
</div>
<!-- 底部导航 -->
<tabBar v-bind:active="0" />
</div>
</template>
... ... @@ -132,7 +158,7 @@
<script>
import Vue from "vue";
import tabBar from "@/components/views/tabBar.vue";
import { List } from "vant";
import { List, Toast } from "vant";
Vue.use(List);
export default {
components: {
... ... @@ -150,13 +176,151 @@ export default {
yinglist: [],
videopage: 1,
this_page: "",
total_page: ""
total_page: "",
now: "",
next: "",
cursekindlist: [],
navindex: 0,
sort_id: ''
};
},
created() {
let that = this;
document.title = "唐元集课堂";
let selnav = localStorage.getItem("selnav");
console.log(selnav)
if (selnav) {
this.selnav = selnav;
if (this.selnav == 0) {
that.total_page = "";
that.this_page = "";
that.videopage = 1;
that.videolist = [];
this.getvideolist();
localStorage.setItem("selnav", "")
} else if (this.selnav == 1) {
that.total_page = "";
that.this_page = "";
this.yinglist = [];
that.videopage = 1;
this.getyingyang();
}
} else {
this.getcourselist()
}
this.getindex();
this.getintence();
},
methods: {
// 进入搜索页
entersearch() {
this.$router.push({
path: "/searchcourse",
query: {
selnav: this.selnav
}
});
},
selectnavsec(id, index) {
let that = this;
this.navindex = index;
this.sort_id = id;
that.videopage = 1;
that.videolist = [];
that.getvideolist();
},
// 获取课程分类
getcourselist() {
let that = this;
let url = '/api/index/sort'
let param = {
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.cursekindlist = res.data;
that.sort_id = res.data[0].id
that.getvideolist();
})
.catch(function (err) {
console.log(err);
});
},
getintence() {
let that = this
console.log(99999)
var result = ""
var url = "/api/user/intended";
let param = {};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
result = res.data
localStorage.setItem("intended", JSON.stringify(res.data.intended))
})
.catch(function (err) {
console.log(err);
});
},
// 获取首页接口
getindex() {
let that = this;
var url = "/api/index/index";
let param = {};
that.$axios
.get(url, param)
.then(function (res) {
console.log(res);
that.now = res.data.now;
that.next = res.data.next;
})
.catch(function (err) {
console.log(err);
});
},
// 进入直播详情
zhibodetail(item) {
console.log(item.allow_join)
this.$router.push({
path: '/userzhibo',
query: {
id: item.id
}
})
if (item.allow_join != undefined) {
if (item.allow_join == 1) {
this.$router.push({
path: '/userzhibo',
query: {
id: item.id
}
})
} else {
Toast("还没开课,请耐心等待")
}
} else {
this.$router.push({
path: '/userzhibo',
query: {
id: item.id
}
})
}
},
// 视频上拉加载
onLoad() {
let that = this;
... ... @@ -174,6 +338,8 @@ export default {
// 加载状态结束
this.loading = false;
// 数据全部加载完成
console.log(that.this_page)
console.log(that.total_page)
if (that.this_page == that.total_page) {
this.finished = true;
}
... ... @@ -208,6 +374,7 @@ export default {
let that = this;
var url = "/api/index/lesson_list";
let param = {
sort_id: that.sort_id,
page: that.videopage
};
... ... @@ -258,16 +425,28 @@ export default {
query: { id: id }
});
},
// 录播详情
coursedetail(item) {
this.$router.push({
path: "/lubodetail",
query: {
id: item.id
}
});
},
selectnav(e) {
let that = this;
this.selnav = e.currentTarget.dataset.id;
localStorage.setItem("selnav", this.selnav)
console.log(this.selnav);
if (this.selnav == 0) {
that.total_page = "";
that.this_page = "";
that.videopage = 1;
that.videolist = [];
this.getvideolist();
this.getcourselist()
} else if (this.selnav == 1) {
that.total_page = "";
that.this_page = "";
... ... @@ -282,4 +461,43 @@ export default {
<style scoped>
@import "../../../style/course.css";
.coursetop {
width: 100%;
background: #fff;
}
.coursetitlek {
color: #02170b;
font-size: 0.32rem;
margin-bottom: 0.12rem;
}
.coursenavleftk {
color: #b5bfba;
font-size: 0.28rem;
text-align: center;
flex: 0 0 auto;
margin-right: 0.52rem;
}
.coursenavleftkk {
width: 6.86rem;
padding: 0.24rem 0;
box-sizing: border-box;
margin: 0 auto;
overflow-x: scroll;
}
.selactive {
position: relative;
color: #599158;
}
.selactive::after {
display: block;
content: "";
width: 0.4rem;
height: 0.02rem;
background: #599158;
position: absolute;
bottom: -0.2rem;
left: 50%;
transform: translateX(-50%);
}
</style>
... ...
<template>
<!-- :style="{'height':height+'px'}" -->
<!-- style="height:600px" -->
<!-- -->
<div class="container" refs="message" id="targetbox">
<div class="sharetop flextwo" @click="back">
<div class="leftrow">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">{{ coursetitle }}</div>
<div class="sharebtn" @click.stop="collect">
{{ is_favorite }}
<img src="../../../assets/starkong.png" v-if="is_favorite == 0" alt />
<img src="../../../assets/star.png" v-else alt />
</div>
</div>
<div class="nodata" v-if="recordlist.length == 0">暂无聊天记录</div>
<van-pull-refresh
v-model="isLoading"
@refresh="onRefresh"
class="messagelist"
style="height: 100%"
id="messagebox"
v-else
>
<!-- <div v-clipboard:copy="serverId" v-clipboard:success="onCopy">复制</div> -->
<!-- <p>刷新次数: {{ count }}</p> -->
<!-- <div class="wifi-symbol">
<div class="wifi-circle first"></div>
<div class="wifi-circle second"></div>
<div class="wifi-circle third"></div>
</div>-->
<!-- <div class="voice">
<div class="bg voicePlay"></div>
</div>-->
<div>
<div v-for="(item, index) in recordlist" :key="index">
<div class="messageitem flex" v-if="item.user_id != user_id">
<div class="messageitemleft">
<img :src="item.avatar" alt />
</div>
<div class="messageitemright" v-if="item.type == 1">
<div class="messagecontent">{{ item.data }}</div>
</div>
<div
class="messageitemright imgright"
v-if="item.type == 2"
@click="previewimg(item.data)"
>
<div class="messagecontent">
<div class="contentimg">
<img :src="item.data" alt />
</div>
</div>
</div>
<div class="messageitemright" v-if="item.type == 3">
<div
class="messagecontent"
:style="{ width: 1.7 + 'rem' }"
v-if="item.times > 0 && item.times < 5"
@click="audioplay(item, index)"
>
<div class="voice">
<div
class="bg"
:class="item.sel == true ? 'voicePlay' : ''"
></div>
<div class="miaoshuk">{{ item.times }}'</div>
</div>
</div>
<div
class="messagecontent"
:style="{ width: 2 + 'rem' }"
v-if="item.times >= 5 && item.times < 15"
@click="audioplay(item, index)"
>
<div class="voice">
<div
class="bg"
:class="item.sel == true ? 'voicePlay' : ''"
></div>
<div class="miaoshuk">{{ item.times }}'</div>
</div>
</div>
<div
class="messagecontent"
:style="{ width: 4.5 + 'rem' }"
v-if="item.times >= 15"
@click="audioplay(item, index)"
>
<div class="voice">
<div
class="bg"
:class="item.sel == true ? 'voicePlay' : ''"
></div>
<div class="miaoshuk">{{ item.times }}'</div>
</div>
</div>
</div>
</div>
<div
class="messageitem messageitemk flex"
v-if="item.user_id == user_id"
:id="item.idkk"
>
<div class="messageitemrightk" v-if="item.type == 1">
<div class="messagecontentk">{{ item.data }}</div>
</div>
<div
class="messageitemrightk"
v-if="item.type == 2"
@click="previewimg(item.data)"
>
<div class="messagecontentk">
<div class="contentimg">
<img :src="item.data" alt />
</div>
</div>
</div>
<!-- v-clipboard:copy="that.serverId"
v-clipboard:success="onCopy"-->
<div class="messageitemrightk" v-if="item.type == 3">
<div
class="messagecontentk yuyink"
:style="{ width: 1 + 'rem' }"
v-if="item.times > 0 && item.times < 5"
@click="audioplay(item, index)"
>
<div class="voice voiceright">
<div
class="bg"
:class="item.sel == true ? 'voicePlay' : ''"
></div>
<div class="miaoshu">{{ item.times }}'</div>
</div>
</div>
<div
class="messagecontentk yuyink"
:style="{ width: 2 + 'rem' }"
v-if="item.times >= 5 && item.times < 15"
@click="audioplay(item, index)"
>
<div class="voice voiceright">
<div
class="bg"
:class="item.sel == true ? 'voicePlay' : ''"
></div>
<div class="miaoshu">{{ item.times }}'</div>
</div>
</div>
<div
class="messagecontentk yuyink"
:style="{ width: 4.5 + 'rem' }"
v-if="item.times >= 15"
@click="audioplay(item, index)"
>
<div class="voice voiceright">
<div
class="bg"
:class="item.sel == true ? 'voicePlay' : ''"
></div>
<div class="miaoshu">{{ item.times }}'</div>
</div>
</div>
</div>
<div class="messageitemleftk">
<img :src="item.avatar" alt />
</div>
</div>
</div>
</div>
</van-pull-refresh>
<!-- 底部导航 -->
<!-- <div class="messagebot messagebotkk flexone" v-if="is_self == 0 && isbot == true">
<div class="messagebotleft">
<img src="../../../assets/yuyin.png" alt />
</div>
<div class="writermessage">
<input type="text" placeholder="写留言" @input="entertext" :value="text" />
</div>
<div class="sendk" @click="send">发送</div>
</div>
<div v-if="is_self == 1">
<div class="messagebot messagebotkk flexone" v-if="sendword">
<div class="messagebotleft" @click="changeword">
<img src="../../../assets/yuyin.png" alt />
</div>
<div class="writermessage">
<input type="text" placeholder="写留言" @input="entertext" :value="text" />
</div>
<div class="sendk" @click="send">发送</div>
</div>
<div class="messagebot messagebotk flextwo" v-else>
<img src="../../../assets/yuyin.png" alt class="zhibobtn" @click="changeword" />
<img src="../../../assets/pic.png" alt class="zhibobtn" @click="choseimg" />
<img src="../../../assets/luyin.png" alt class="yuyinbtn" @click="yuyin" />
<img src="../../../assets/shangchuan.png" alt class="zhibobtn" />
<img src="../../../assets/kaiguan.png" alt class="zhibobtn" @click="stopbtn" />
</div>
</div>
<div class="manypeople">
<img src="../../../assets/manypeople.png" alt class="manypeopleimg" />
{{ group_count }}
</div>-->
<!-- 直播结束了 -->
<!-- <div class="register" v-if="iszhibo">
<div class="zhiboover">
<div class="zhibovoertop">本次直播内容同步保存到录播</div>
<div class="zhiboque" @click="overvideo">同步到录音并结束</div>
</div>
</div>
<div class="register" v-if="showtips">
<div class="zhiboover">
<div class="zhibovoertop">来早了,还没到开课时间</div>
<div class="zhiboque" @click="suretips">确定</div>
</div>
</div>-->
<!-- 上传成功 -->
<div class="register" v-if="issuccess">
<div class="zhiboover">
<div class="zhibovoertop">
<img src="../../../assets/upsuccess.png" alt class="successimg" />
<div class="successname">上传成功</div>
</div>
<div class="zhiboque" @click="sureup">确认</div>
</div>
</div>
<!-- 开始录制 -->
<div class="register" style="z-index: 999" v-if="beginlushow" @click="hide">
<div class="luwrap" @click.stop="beginluyin">
<div class="beginlu">开始录制</div>
<div>
<img src="../../../assets/beginlu.png" alt class="beginluimg" />
</div>
</div>
</div>
<!-- 正在录制 -->
<div class="register" style="z-index: 999" v-if="zhengzailu" @click="hide">
<div class="luwrap" @click.stop="finishluyin">
<div class="beginlu">正在录音:{{ time }}'</div>
<div>
<img src="../../../assets/zhengzailu.png" alt class="beginluimg" />
</div>
</div>
</div>
<!-- 录制完成 -->
<div class="register" style="z-index: 999" v-if="luprocess" @click="hide">
<div class="luwrap">
<div class="beginlu">录音时长:{{ time }}'</div>
<div class="flextwo chonglu">
<div class="relu" @click="resetlu">重录</div>
<div class="send" @click.stop="sendyuyin">发送</div>
<div class="relu" @click.stop="shiting">试听</div>
</div>
</div>
</div>
<!-- 温馨提示 -->
<div class="register" style="z-index: 999" v-if="chonglushow">
<div class="wentipswrap">
<div class="tipsname">温馨提示</div>
<div class="waittips">您确认舍弃该录音重新录制吗</div>
<div class="waitbot flexone">
<div class="waitbotleft">取消</div>
<div class="waitbotlright">重录</div>
</div>
</div>
</div>
<!-- 本次录音是否上传 -->
<div class="register" style="z-index: 999" v-if="shanghcuanshow">
<div class="wentipswrap">
<div class="waittips benci">本次录音是否上传</div>
<div class="waitbot flexone">
<div class="waitbotleft" @click="hideshangchuan">直接结束</div>
<div class="waitbotlright" @click="shangyuyin">上传录音</div>
</div>
</div>
</div>
<!-- 是否结束录播 -->
<div class="register" style="z-index: 999" v-if="overzhibo">
<div class="wentipswrap">
<div class="waittips benci">是否结束直播</div>
<div class="waitbot flexone">
<div class="waitbotleft" @click="canclesure">取消</div>
<div class="waitbotlright" @click="surezhibo">结束</div>
</div>
</div>
</div>
</div>
</template>
<script>
import wx from "jweixin-1.6.0";
import Vue from "vue";
import { PullRefresh, Toast } from "vant";
Vue.use(PullRefresh);
Vue.use(Toast);
var timer = null;
export default {
data() {
return {
iszhibo: false,
issuccess: false,
beginlushow: false,
luprocess: false,
chonglushow: false,
shanghcuanshow: false,
zhengzailu: false,
overzhibo: false,
id: "",
is_self: "",
user_id: "",
showtips: false,
sendword: false,
text: "",
isbot: false,
time: 1,
localId: "",
serverId: "",
number: 0,
group_count: "",
// 直播列表
page: 1,
this_page: '',
total_page: '',
isLoading: false,
recordlist: [],
baseurl: "",
height: '',
hei: '600px',
target: '',
yuyintype: '',
stopurl: '',
stopindex: 0,
coursetitle: "",
playlocalid: '',
is_favorite: 0
};
},
created() {
// 获取个人中心
this.getuserinfo()
// alert(location.host)
this.baseurl = 'http://' + location.host
let div = this.$refs["message-list"];
// alert(1111)
// alert(this.baseurl+
// "/redirect.html?shareRedirect=" +
// encodeURIComponent(window.location.href))
document.title = "唐元集公众号";
this.id = this.$route.query.id;
// 获取appid
this.getappid();
this.getlubodetail();
this.initWebSocket();
// 获取直播列表
this.getzhibolist()
},
mounted() {
let that = this
console.log(that.target, '99997878666')
},
watch: {
},
beforeRouteEnter(to, from, next) {
var u = navigator.userAgent;
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
// XXX: 修复iOS版微信HTML5 History兼容性问题
if (isiOS && to.path !== location.pathname) {
// 此处不可使用location.replace
location.assign(to.fullPath);
} else {
next();
}
},
methods: {
//获取个人中心
getuserinfo() {
let that = this;
var url = "/api/user/index";
let param = {
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.user_id = res.data.id
})
.catch(function (err) {
});
},
// 列表自动滚到到底部
toBottom() {
// let listContainer = document.getElementById('messagebox')
let div = this.$refs["message-list"];
console.log(div.scrollHeight, 8887766543)
console.log(div.style.height, 9999)
this.height = div.clientHeight
div.scrollTop = div.scrollHeight
// let height = div.offsetHeight
// console.log(height, 9999888888)
// const listContainer = this.$refs["message-list"];
// console.log(listContainer, '9999887766543434334345454')
// listContainer.scrollTop = height;
// this.$forceUpdate()
},
// 视频上拉加载
onLoad() {
let that = this;
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
console.log(3434);
let newpage = that.page;
newpage++;
that.page = newpage;
console.log(that.page);
that.getzhibolist();
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (that.this_page == that.total_page) {
this.finished = true;
}
}, 1000);
},
onRefresh() {
let that = this;
setTimeout(() => {
this.isLoading = false;
// Toast('刷新成功');
if (that.this_page != that.total_page) {
let newpage = that.page;
newpage++;
that.page = newpage;
console.log(that.page);
that.getzhibolist();
}
}, 1000);
},
// 获取appid
getappid() {
let that = this;
console.log(34734894890);
let urlk = window.location.href;
var url = "/api/user/wechat_jssdk";
let param = {
url: urlk
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
wx.config({
debug: false,
appId: res.data.jssdk.appId, // 和获取Ticke的必须一样------必填,公众号的唯一标识
timestamp: res.data.jssdk.timestamp, // 必填,生成签名的时间戳
nonceStr: res.data.jssdk.nonceStr, // 必填,生成签名的随机串
signature: res.data.jssdk.signature, // 必填,签名,见附录1
//需要分享的列表项:发送给朋友,分享到朋友圈,分享到QQ,分享到QQ空间
jsApiList: [
"startRecord",
"stopRecord",
"playVoice",
"uploadVoice",
"playVoice",
"downloadVoice",
"stopVoice",
"chooseImage",
"uploadImage",
"updateAppMessageShareData",
"updateTimelineShareData",
"previewImage"
]
});
that.sharetofriend()
})
.catch(function (err) {
console.log(err);
});
},
// 分享给朋友
sharetofriend() {
var that = this;
// 处理验证失败的信息
wx.error(function (res) {
logUtil.printLog("验证失败返回的信息:", res);
});
// 处理验证成功的信息
wx.ready(function () {
// alert(window.location.href.split('#')[0]);
// var share_title = that.sharemsg.title;
// if (share_title.indexOf("${title}") >= 0) {
// share_title = share_title.replace(
// "${title}",
// that.details.details.title
// );
// }
// var share_desc = that.sharemsg.content;
// if (share_desc.indexOf("${title}") >= 0) {
// share_desc = share_desc.replace(
// "${title}",
// that.details.details.title
// );
// }
// if (share_desc.indexOf("${text}") >= 0) {
// share_desc = share_desc.replace("${text}", that.details.details.text);
// }
// 分享到朋友圈
wx.updateTimelineShareData({
title: '分享', // 分享标题
link: that.baseurl +
"/redirect.html?shareRedirect=" +
encodeURIComponent(window.location.href), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: 'http://tangyuanji.t.brotop.cn/uploads/20200804/fcabfaf5aa3c856ced04703b0a78a467.png',
// imgUrl: that.details.details.img
// ? that.details.details.img
// : that.sharemsg.img,
// 分享图标
// desc: that.sharemsg.content,
success: function (res) {
// 用户确认分享后执行的回调函数
console.log("suss");
logUtil.printLog("分享到朋友圈成功返回的信息为:", res);
that.showMsg("分享成功!");
},
cancel: function (res) {
// 用户取消分享后执行的回调函数
console.log("err");
logUtil.printLog("取消分享到朋友圈返回的信息为:", res);
}
}),
// 分享给朋友
wx.updateAppMessageShareData({
title: '分享', // 分享标题
desc: '分享', // 分享描述
link:
that.baseurl +
"/redirect.html?shareRedirect=" +
encodeURIComponent(window.location.href), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: 'http://tangyuanji.t.brotop.cn/uploads/20200804/fcabfaf5aa3c856ced04703b0a78a467.png',
// imgUrl: that.details.details.img
// ? that.details.details.img
// : that.sharemsg.img,
// 分享图标
type: "", // 分享类型,music、video或link,不填默认为link
dataUrl: "", // 如果type是music或video,则要提供数据链接,默认为空
success: function (res) {
// 用户确认分享后执行的回调函数
logUtil.printLog("分享给朋友成功返回的信息为:", res);
},
cancel: function (res) {
// 用户取消分享后执行的回调函数
logUtil.printLog("取消分享给朋友返回的信息为:", res);
}
});
});
},
// 上传图片
choseimg() {
let that = this
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
wx.uploadImage({
localId: localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) {
var serverId = res.serverId; // 返回图片的服务器端ID
that.serverId = res.serverId;
that.upload()
}
});
}
});
},
upload() {
let that = this;
console.log(34734894890)
var url = "/api/user/upload_media";
let param = {
type: 1,
media_id: that.serverId
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.videourl = res.data.media;
let objdata = {
lesson_id: that.id,
type: 2,
user_id: that.user_id,
times: 0,
data: that.videourl
};
objdata = JSON.stringify(objdata);
// alert(objdata);
that.websocketsend(objdata);
// alert(that.videourl)
})
.catch(function (err) {
console.log(err);
});
},
// 预览图片
previewimg(url) {
let arr = [];
arr.push(url)
wx.previewImage({
current: url, // 当前显示图片的http链接
urls: arr// 需要预览的图片http链接列表
});
},
// 隐藏遮罩层
hide() {
this.beginlushow = false;
this.zhengzailu = false;
this.luprocess = false;
wx.pauseVoice({
localId: that.localId // 需要暂停的音频的本地ID,由stopRecord接口获得
});
},
// 返回上一页
back() {
this.$router.go(-1);
},
overvideo() {
this.iszhibo = false;
},
sureup() {
this.issuccess = false;
},
// 隐藏来早了还没开课
suretips() {
// this.$router.go(-1)
this.showtips = false;
},
// 切换语音发送还是文字发送
changeword() {
this.sendword = !this.sendword;
console.log(this.sendword);
},
// 输入文字
entertext(e) {
this.text = e.target.value;
},
// 开始录制
yuyin() {
this.beginlushow = true;
this.yuyintype = 1
},
// 开始录音
beginluyin() {
console.log(83434898989);
let that = this;
that.beginlushow = false;
that.zhengzailu = true;
let time = 0;
timer = setInterval(() => {
time++;
that.time = time;
console.log(that.time);
}, 1000);
wx.startRecord({
success: function (res) {
// alert(JSON.stringify(res))
consoel.log(res, 99977775655);
// alert('成功调起录音')
// that.timer = setInterval(() => {
// time++;
// that.time = time
// }, 1000)
// that.vicoeEnd()
},
cancel: function () {
// alert("用户拒绝授权录音");
}
});
},
// 完成录音
finishluyin() {
let that = this;
this.zhengzailu = false;
this.luprocess = true;
clearInterval(timer);
wx.stopRecord({
success: function (res) {
var localId = res.localId;
that.localId = res.localId;
that.upyuyin();
}
});
},
// 试听录音
shiting() {
wx.playVoice({
localId: this.localId // 需要播放的音频的本地ID,由stopRecord接口获得
});
},
// 结束本次上传
hideshangchuan() {
this.shanghcuanshow = false
},
// 发送语音
sendyuyin() {
this.shanghcuanshow = true
},
shangyuyin() {
let that = this;
this.shanghcuanshow = false
that.luprocess = false;
this.issuccess = true
let objdata = {
lesson_id: this.id,
type: 3,
user_id: this.user_id,
times: that.time,
data: that.serverId
};
objdata = JSON.stringify(objdata);
// alert(objdata);
that.websocketsend(objdata);
},
// 上传语音到后台
upyuyin() {
let that = this;
wx.uploadVoice({
localId: that.localId, // 需要上传的音频的本地ID,由stopRecord接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) {
var serverId = res.serverId; // 返回音频的服务器端ID
that.serverId = res.serverId;
// alert(that.serverId);
// that.upload()
}
});
},
// 重录
resetlu() {
this.time = 0;
this.luprocess = false;
this.beginlushow = true;
clearInterval(this.timer);
},
// 停止直播
stopbtn() {
this.overzhibo = true
},
canclesure() {
this.overzhibo = false
},
surezhibo() {
let that = this;
that.overzhibo = false
let objdata = {
lesson_id: this.id,
type: 3,
user_id: this.user_id,
times: that.time,
data: '', is_end: 1
};
objdata = JSON.stringify(objdata);
// alert(objdata);
this.websocketsend(objdata);
},
// 获取录播详情
getlubodetail() {
let that = this;
console.log(34734894890);
var url = "/api/user/lesson_detail";
let param = {
lesson_id: that.id
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.is_self = res.data.lesson.is_self;
that.coursetitle = res.data.lesson.title;
that.is_favorite = res.data.lesson.is_favorite;
// that.user_id = res.data.lesson.user_id;
let duration = res.data.lesson.duration;
if (that.is_self == 0) {
if (duration != 0) {
that.showtips = true;
that.isbot = false;
}
}
timer = setInterval(() => {
duration = duration - 1;
if (duration <= 0) {
that.showtips = false;
that.isbot = true;
clearInterval(timer);
}
}, 1000);
})
.catch(function (err) {
console.log(err);
});
},
collect() {
let that = this;
var url = "/api/user/favorite";
let param = {
type: 4,
favorite_id: that.id
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
if (that.is_favorite == false) {
that.is_favorite = true;
Toast("收藏成功");
} else {
that.is_favorite = false;
Toast("取消收藏成功");
}
})
.catch(function (err) {
console.log(err);
});
},
// 链接websocket
initWebSocket() {
//初始化weosocket
// const wsuri = "ws://tangyuanji.t.brotop.cn:11001";
this.websock = new WebSocket("ws://tangyuanji.t.brotop.cn:11001");
this.websock.onmessage = this.websocketonmessage;
this.websock.onopen = this.websocketonopen;
this.websock.onerror = this.websocketonerror;
this.websock.onclose = this.websocketclose;
},
websocketonopen() {
//连接建立之后执行send方法发送数据
console.log("连接成功");
},
websocketonerror() {
//连接建立失败重连
this.initWebSocket();
},
websocketonmessage(e) {
//数据接收
let that = this;
if (this.number == 0) {
let obj = { lesson_id: this.id, user_id: this.user_id, is_group: 1, first: 1 };
obj = JSON.stringify(obj);
console.log(obj);
this.websocketsend(obj);
// let data=e.
}
this.number = this.number + 1;
this.number = this.number;
let datak = e.data
console.log(e, 88890999);
console.log(e.data)
// alert(e.data)
// alert(e.data.first)
let data = JSON.parse(e.data);
// alert(data)
console.log(data)
that.group_count = data.group_count;
// 接收数据重新渲染列表
if (data.lesson_id != undefined) {
const redata = JSON.parse(e.data);
that.group_count = redata.group_count;
if (redata.code == 0) {
Toast(redata.msg)
} else if (redata.code == 1) {
that.recordlist.push(redata);
that.recordlist = that.recordlist;
that.$forceUpdate();
console.log(that.recordlist)
}
}
},
websocketsend(Data) {
//数据发送
console.log(99999);
this.websock.send(Data);
},
websocketclose(e) {
//关闭
console.log("断开连接", e);
},
// 获取直播列表
getzhibolist() {
let that = this;
console.log(34734894890)
var url = "/api/user/lesson_chat_record";
let param = {
lesson_id: that.id,
page: that.page
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res, '直播列表');
if (that.page == 1) {
// 页面滚动到某一个位置
let len = res.data.record.length;
len = len - 1
res.data.record.forEach(function (value, index, array) {
if (index == len) {
value.idkk = 'targetboxk'
that.$nextTick(() => {
setTimeout(() => {
let targetbox = document.getElementById('targetboxk');
that.target = targetbox.offsetTop;
document.body.scrollTop = that.target;
document.getElementById('targetbox').scrollTop = that.target
})
})
}
})
}
// 拼接数组倒叙
var arr = [...res.data.record, ...that.recordlist];
that.recordlist = arr
that.recordlist.forEach(function (value, index, array) {
value.sel = false
})
that.recordlist = that.recordlist
that.this_page = res.data.this_page
that.total_page = res.data.total_page;
})
.catch(function (err) {
console.log(err);
});
},
audioplay(item, index) {
let that = this;
console.log(item)
// 播放某一个语音
// that.recordlist[index].sel = !that.recordlist[index].sel;
that.recordlist.forEach(function (value, indexk, array) {
if (index == indexk) {
that.recordlist[indexk].sel = !that.recordlist[indexk].sel;
} else {
that.recordlist[indexk].sel = false
}
})
that.recordlist = that.recordlist;
that.$forceUpdate();
console.log(that.recordlist)
if (this.recordlist[index].sel == true) {
// 开始播放
let localId = ''
wx.downloadVoice({
serverId: item.data, // 需要下载的音频的服务器端ID,由uploadVoice接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) {
localId = res.localId; // 返回音频的本地ID
that.playlocalid = localId;
that.recordlist[index].localId = localId;
that.recordlist = that.recordlist;
that.$forceUpdate()
wx.playVoice({
localId: localId // 需要播放的音频的本地ID,由stopRecord接口获得
})
}
});
} else if (this.recordlist[index].sel == false) {
// 停止播放
wx.stopVoice({
localId: that.playlocalid // 需要暂停的音频的本地ID,由stopRecord接口获得
});
}
// 监听播放停止播放下一个
wx.onVoicePlayEnd({
success: function (res) {
var localId = res.localId; // 返回音频的本地ID
that.recordlist.forEach(function (value, index, array) {
if (localId == value.localId) {
value.sel = false
}
})
that.recordlist = that.recordlist
that.$forceUpdate();
index = index + 1;
if (that.recordlist[index].data != undefined) {
if (that.recordlist[index].type == 3) {
that.recordlist[index].sel = true
wx.downloadVoice({
serverId: that.recordlist[index].data, // 需要下载的音频的服务器端ID,由uploadVoice接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) {
let localId = res.localId; // 返回音频的本地ID
that.recordlist[index].localId = localId;
that.recordlist[index].sel = true;
that.recordlist = that.recordlist;
that.$forceUpdate()
wx.playVoice({
localId: localId // 需要暂停的音频的本地ID,由stopRecord接口获得
});
}
});
}
}
that.recordlist = that.recordlist;
that.$forceUpdate()
}
});
},
// 发送文字
send() {
// var ws = new WebSocket("ws://tangyuanji.t.brotop.cn:11001");
let objdata = {
lesson_id: this.id,
type: 1,
user_id: this.user_id,
times: 0,
data: this.text
};
console.log(objdata)
objdata = JSON.stringify(objdata);
// alert(objdata)
this.websocketsend(objdata);
this.text = ''
// ws.send(objdata);
}
}
};
</script>
<style scoped>
/* 34348989 */
/* 45548548 */
.container {
overflow: auto;
}
.sendk {
width: 1.14rem;
height: 0.6rem;
background: #599158;
border-radius: 0.04rem;
color: #fff;
font-size: 0.32rem;
text-align: center;
line-height: 0.6rem;
margin-left: 0.16rem;
}
.waitbot {
border-top: 1px solid #f5f5f5;
margin-top: 0.48rem;
}
.waitbotlright {
width: 3.1rem;
height: 0.96rem;
text-align: center;
color: #579057;
font-size: 0.32rem;
line-height: 0.96rem;
}
.waitbotleft {
width: 3.1rem;
height: 0.96rem;
border-right: 1px solid #f5f5f5;
text-align: center;
color: #323233;
font-size: 0.32rem;
line-height: 0.96rem;
}
/* 温馨提示 */
.waittips {
color: #7d7e80;
font-size: 0.28rem;
text-align: center;
margin-top: 0.16rem;
}
.tipsname {
color: #323233;
font-size: 0.32rem;
font-weight: bold;
text-align: center;
margin-top: 0.48rem;
text-align: center;
}
.benci {
margin-top: 0.68rem;
}
.wentipswrap {
width: 6.22rem;
background: #ffffff;
border-radius: 0.08rem 0.08rem 0 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.chonglu {
padding: 0 0.84rem;
box-sizing: border-box;
margin-top: 0.2rem;
}
.relu {
width: 1.04rem;
height: 1.04rem;
border: 1px solid #72a970;
/* box-shadow: 0 0.04rem 0.36rem 0 rgba(125, 178, 121, 0.56); */
color: #5c945c;
font-size: 0.32rem;
text-align: center;
line-height: 1.04rem;
border-radius: 50%;
}
.send {
width: 1.6rem;
height: 1.6rem;
background: linear-gradient(135deg, #87bd87 1%, #4a834a);
box-shadow: 0 0.04rem 0.36rem 0 rgba(125, 178, 121, 0.56);
border-radius: 50%;
color: #ffffff;
font-size: 0.4rem;
text-align: center;
line-height: 1.6rem;
}
.beginlu {
color: #323233;
font-size: 0.28rem;
text-align: center;
}
.beginluimg {
width: 1.6rem;
height: 1.6rem;
font-size: 0;
margin-top: 0.16rem;
}
.luwrap {
padding: 0.4rem 0;
box-sizing: border-box;
text-align: center;
width: 100%;
position: fixed;
bottom: 0;
left: 0;
background: #fff;
z-index: 99999;
}
.successname {
color: #7d7e80;
font-size: 0.28rem;
margin-top: 0.16rem;
text-align: center;
}
.successimg {
width: 1.6rem;
height: 1.6rem;
font-size: 0;
}
.zhiboover {
width: 6.22rem;
background: #ffffff;
border-radius: 0.08rem 0.08rem 0 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.zhibovoertop {
padding: 0.48rem 0;
box-sizing: border-box;
border-bottom: 1px solid #f5f5f5;
color: #323233;
font-size: 0.28rem;
text-align: center;
}
.zhiboque {
color: #599158;
font-size: 0.32rem;
text-align: center;
padding: 0.24rem 0;
box-sizing: border-box;
}
.messagebot {
background: #fff;
padding: 0 0.72rem;
box-sizing: border-box;
}
.messagebotk {
padding: 0.16rem 0.72rem;
box-sizing: border-box;
}
.messagebotkk {
padding: 0 0.32rem;
box-sizing: border-box;
}
.zhibobtn {
width: 0.56rem;
height: 0.56rem;
font-size: 0;
}
.yuyinbtn {
width: 0.84rem;
height: 0.84rem;
font-size: 0;
}
.manypeople {
padding: 0.14rem 0.4rem;
color: #868686;
font-size: 0.28rem;
box-sizing: border-box;
opacity: 0.74;
background: #f7f7f7;
border-radius: 0.4rem;
box-shadow: 0 0.16rem 0.3rem 0 rgba(142, 190, 142, 0.33);
position: fixed;
bottom: 1.2rem;
right: 0.32rem;
z-index: 9;
}
.manypeopleimg {
width: 0.32rem;
height: 0.28rem;
font-size: 0;
}
.messagelist {
/* height: 15rem; */
/* padding-bottom: 1.5rem; */
}
.contentimg {
width: 4.15rem;
height: 2.95rem;
font-size: 0;
}
.contentimg {
widows: 100%;
height: 100%;
}
.yuyink {
display: flex;
justify-content: flex-end;
}
.sharetop {
z-index: 999;
}
.messagecontent {
/* background: #999; */
}
/* 语音聊天 */
.voice {
/* padding-top: 12px;
padding-left: 10px; */
/* margin: 100px auto; */
/* height: 35px;
width: 150px; */
/* background: #87bd87; */
background: #fff;
border-radius: 0 7px 7px;
color: #333;
position: relative;
}
.voiceright {
transform: rotate(-180deg);
}
.miaoshu {
position: absolute;
left: 0.6rem;
bottom: 0.15rem;
font-size: 0.22rem;
transform: rotate(180deg);
}
.miaoshuk {
position: absolute;
left: 0.55rem;
bottom: 0.12rem;
font-size: 0.12rem;
}
.bg {
/* background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAYCAYAAAAF6fiUAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NzlFRDZDRDNENzlFMTFFNkJDN0NFMjA2QTFFRTRDQkIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NzlFRDZDRDJENzlFMTFFNkJDN0NFMjA2QTFFRTRDQkIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MTAxQkEzQ0RENzM2MTFFNjgyMEI5MTNDRkQ0OTM5QUEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MTAxQkEzQ0VENzM2MTFFNjgyMEI5MTNDRkQ0OTM5QUEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4K4iKVAAACUUlEQVR42uSazytEURTHvTHjR4kaU8xsSDZSdmbjx4oSK8XGQrJlpSwYTSmxEWWhUIpsZK3kD7DRNBuSBZFCNjZ+JPKcV6ecXu/d3sy7595bc+vbfXPue5/749z77o83lm3bZYYFC8RZqAbQAigP2tXNj5aZF7gdkAZNk9+7WvnOCCgxRUCb9n/o1sk3pUH6QDHF/GNsoM+QeYfiy6qkFeLZDBb0GlTB4AAR/xXT9nXxZVa0WCekQd9Y0HOJjg3CHySviiZmfjO3AyIhnu0gBc0wjAIR/wLtW8z87aAOWAI9gqaYRoAff4ZUoi7EKCiUP462j4CdSCrfK4N1Ahpi6I0i/hPa50M4oFB+Dbm/SzXfL5MD4rUogxP8+Itozynm59E+q5ovyuQdHxphWh568XvR5kxq1SEn40L4e0XMA1L4EcEe7RTjLqYdqRf/gezQUwr5LxjXq+aLHPCFcTmTA7z4tutIQhXfLiJPKXyRA/oxzgW8v9DgxU+S62eF/ATGr6r5fg26Corj9RHD4Z0fvwfjS9CbQn4bxrfK+R6TyzxZNk260solTL4i/g3al10TsMXIryA72T7VfK8MnJO8X9CKy14lafXjxx8jFUsSeyUzfxhtPwHPoqTy/TJJMJzJiPgNpJdsuNJizPwztB/q4JtwHN2KW3sn3HuMOouR30l6bbsOvgkOyGIBnaPbRldalJl/h2knuvgmOKAWNAFKMUz4Iv4O6Z1xXXxTPxtazHy6khnVyS/Fb8IDpHGyuvmWgX9L4Q4toDnQFWhNN/9PgAEAR4w1ULjdCbEAAAAASUVORK5CYII=)
right 0 no-repeat; */
background: url(http://tangyuanji.t.brotop.cn/assets/images/media_icon.png)
no-repeat center;
width: 24px;
height: 24px;
background-size: 100%;
}
.voicePlay {
animation-name: voicePlay;
animation-duration: 1.2s;
animation-direction: normal;
animation-iteration-count: infinite;
animation-timing-function: steps(3);
/* animation: fadeInOut 1s infinite 0.4s; */
}
@keyframes voicePlay {
0% {
opacity: 0;
}
20% {
opacity: 0.2;
}
40% {
opacity: 0.6;
}
80% {
opacity: 0.8;
}
100% {
opacity: 1;
}
}
/* @keyframes voicePlay {
0% {
background-position: 0;
}
100% {
background-position: -200%;
}
} */
.box {
width: 1.2rem;
height: 1.2rem;
box-sizing: border-box;
position: relative;
margin: 0.5rem auto;
}
.wifi-symbol {
width: 0.5rem;
height: 0.5rem;
box-sizing: border-box;
overflow: hidden;
transform: rotate(135deg);
}
.wifi-circle {
border: 0.03rem solid #999999;
border-radius: 50%;
position: absolute;
}
.first {
width: 0.05rem;
height: 0.05rem;
background: #cccccc;
top: 0.45rem;
left: 0.45rem;
}
.second {
width: 0.25rem;
height: 0.25rem;
top: 0.35rem;
left: 0.35rem;
animation: fadeInOut 1s infinite 0.2s;
}
.third {
width: 0.4rem;
height: 0.4rem;
top: 0.25rem;
left: 0.25rem;
animation: fadeInOut 1s infinite 0.4s;
}
@keyframes fadeInOut {
0% {
opacity: 0;
/*初始状态 透明度为0*/
}
100% {
opacity: 1;
/*结尾状态 透明度为1*/
}
}
/*
.box {
width: 1.2rem;
height: 1.2rem;
box-sizing: border-box;
position: relative;
margin: 0.05rem auto;
}
.wifi-symbol {
width: 0.05rem;
height: 0.05rem;
box-sizing: border-box;
overflow: hidden;
transform: rotate(135deg);
}
.wifi-symbolk {
transform: rotate(315deg);
}
.wifi-circle {
border: 0.05rem solid #999999;
border-radius: 50%;
position: absolute;
}
.first {
width: 0.05rem;
height: 0.05rem;
background: #cccccc;
top: 0.45rem;
left: 0.45rem;
}
.second {
width: 0.25rem;
height: 0.25rem;
top: 0.35rem;
left: 0.35rem;
}
.third {
width: 0.4rem;
height: 0.4rem;
top: 0.25rem;
left: 0.25rem;
}
.secondan {
animation: fadeInOut 1s infinbite 0.2s;
}
.thirdan {
animation: fadeInOut 1s infinite 0.4s;
}
@keyframes fadeInOut {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
} */
/* .box {
width: 120px;
height: 120px;
box-sizing: border-box;
position: relative;
margin: 50px auto;
}
.wifi-symbol {
width: 50px;
height: 50px;
box-sizing: border-box;
overflow: hidden;
transform: rotate(135deg);
}
.wifi-symbolk {
transform: rotate(315deg);
}
.wifi-circle {
border: 5px solid #999999;
border-radius: 50%;
position: absolute;
}
.first {
width: 0.05rem;
height: 0.05rem;
background: #cccccc;
top: 45px;
left: 45px;
}
.second {
width: 0.25rem;
height: 0.25rem;
top: 35px;
left: 35px;
animation: fadeInOut 1s infinite 0.2s;
}
.third {
width: 0.4rem;
height: 0.4rem;
top: 25px;
left: 25px;
animation: fadeInOut 1s infinite 0.4s;
}
@keyframes fadeInOut {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
} */
</style>
... ...
<template>
<div class="container">
<div class="flextwo sharetopk" @click="back">
<div class="leftrow leftrowkimg">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">搜索</div>
<div class="sharebtn">
<!-- <img src="../../../assets/sharebtn.png" alt /> -->
</div>
</div>
<!-- 顶部搜素 -->
<div class="searchhead">
<div class="searchbox flexone">
<div class="searchimg">
<img src="../../../assets/search.png" alt />
</div>
<input type="text" placeholder="搜索你感兴趣的课程文章" class="searchtext" @keyup.enter="selsectword" />
</div>
</div>
<div class="courseboxbox">
<!-- 课程 -->
<div v-if="selnav == 0">
<div class="nodata" v-if="videolist.length == 0">暂无数据</div>
<van-list
class="courseboxk"
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
v-else
>
<div
class="courseboxitem"
v-for="(item, index) in videolist"
:key="index"
@click="coursedetail(item)"
>
<div class="coursenameimg">
<img :src="item.image" alt />
</div>
<div class="coursetext">
<div class="coursetitle">{{ item.title }}</div>
<div class="coursename">{{ item.description }}</div>
<div class="courseteacher">讲师:{{ item.user.nickname }}</div>
</div>
</div>
</van-list>
</div>
<!-- 营养小知识 -->
<div v-if="selnav == 1">
<div class="nodata" v-if="yinglist.length == 0">暂无数据</div>
<van-list
class="courseboxk"
v-model="loadingying"
:finished="finishedying"
finished-text="没有更多了"
@load="onLoadyinyang"
v-else
>
<div
class="courseboxitem"
v-for="item in yinglist"
:key="item.id"
@click="yingyangdetail(item.id)"
>
<div class="coursenameimg">
<img :src="item.image" alt />
</div>
<div class="coursetext">
<div class="coursename knowlagename" v-html="item.title"></div>
</div>
</div>
</van-list>
</div>
</div>
</div>
</template>
<script>
import Vue from "vue";
import tabBar from "@/components/views/tabBar.vue";
import { List } from "vant";
Vue.use(List);
export default {
data() {
return {
selnav: 0,
loading: false,
finished: false,
videolist: [],
// 营养知识
loadingying: false,
finishedying: false,
yinglist: [],
videopage: 1,
this_page: "",
total_page: "",
now: "",
next: "",
keyword: ""
};
},
created() {
document.title = "唐元集公众号";
this.selnav = this.$route.query.selnav;
if (this.selnav == 0) {
this.getvideolist();
} else if (this.selnav == 1) {
this.getyingyang();
}
},
methods: {
back() {
this.$router.go(-1);
},
selsectword(e) {
console.log(e);
this.keyword = e.target.value;
this.videolist = [];
this.videopage = 1;
this.yinglist = [];
if (this.selnav == 0) {
this.getvideolist();
} else if (this.selnav == 1) {
this.getyingyang();
}
},
// 获取首页接口
getindex() {
let that = this;
var url = "/api/index/index";
let param = {};
that.$axios
.get(url, param)
.then(function (res) {
console.log(res);
that.now = res.data.now;
that.next = res.data.next;
})
.catch(function (err) {
console.log(err);
});
},
// 视频上拉加载
onLoad() {
let that = this;
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
console.log(3434);
let newvideopage = that.videopage;
newvideopage++;
that.videopage = newvideopage;
console.log(that.videopage);
that.getvideolist();
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (that.this_page == that.total_page) {
this.finished = true;
}
}, 1000);
},
// 营养知识上拉加载
onLoadyinyang() {
let that = this;
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
console.log(3434);
let newvideopage = that.videopage;
newvideopage++;
that.videopage = newvideopage;
console.log(that.videopage);
that.getyingyang();
// 加载状态结束
this.loadingying = false;
// 数据全部加载完成
if (that.this_page == that.total_page) {
this.finishedying = true;
}
}, 1000);
},
// 获取视频
getvideolist() {
let that = this;
var url = "/api/index/lesson_list";
let param = {
keyword: that.keyword,
page: that.videopage
};
that.$axios
.post(url, param, Headers)
.then(res => {
console.log(res, "列表");
that.videolist = that.videolist.concat(res.data.lesson);
that.total_page = res.data.total_page;
that.this_page = res.data.this_page;
})
.catch(err => {
console.log(err);
// setTimeout(function () {
// that.$router.go(-1)
// })
});
},
// 获取营养知识
getyingyang() {
console.log(9999);
let that = this;
var url = "/api/index/knowledge_list";
let param = {
keyword: that.keyword,
page: that.videopage
};
that.$axios
.post(url, param)
.then(res => {
console.log(res, "列表");
that.yinglist = that.yinglist.concat(res.data.knowledge);
that.total_page = res.data.total_page;
that.this_page = res.data.this_page;
})
.catch(err => {
console.log(err);
// setTimeout(function () {
// that.$router.go(-1)
// })
});
},
// 进入营养详情页面
yingyangdetail(id) {
this.$router.push({
path: "/yingyangdetail",
query: { id: id }
});
},
// 录播详情
coursedetail(item) {
this.$router.push({
path: "/lubodetail",
query: {
id: item.id
}
});
}
}
};
</script>
<style scoped>
@import "../../../style/course.css";
.coursetitlek {
color: #02170b;
font-size: 0.32rem;
margin-bottom: 0.12rem;
}
.searchhead {
margin-top: 0.8rem;
}
.courseboxbox {
margin-top: 2rem;
}
</style>
... ...
<template>
<div class="containerbox"></div>
<div class="containerbox">
<div class="sharetop flextwo" @click="back">
<div class="leftrow">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">图文类</div>
<div class="flexone" @click.stop="collect">
<div class="sharebtn" style="margin-right:0.5rem;width:0.4rem;height:0.4rem">
<img src="../../../assets/nostar.png" alt v-if="yingyangdetail.is_favorite==0" />
<img src="../../../assets/star.png" alt v-else />
</div>
<div class="sharebtn">
<img src="../../../assets/sharebtn.png" alt />
</div>
</div>
</div>
<div class="yingyangbox">
<div class="yingyangtitle">{{yingyangdetail.title}}</div>
<div class="yingyangcontent" v-html="yingyangdetail.content"></div>
</div>
</div>
</template>
<script>
import { Toast } from 'vant';
export default {
data() {
return {
id: ''
id: '',
yingyangdetail: '',
}
},
created() {
this.id = this.$route.query.id;
},
methods: {
back() {
this.$router.go(-1)
},
getdetail() {
let that = this;
var url = "/api/index/knowledge_detail";
let param = {
id: that.id
knowledge_id: that.id
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.yingyangdetail = res.data.knowledge
})
.catch(function (err) {
console.log(err);
});
},
collect() {
let that = this;
var url = "/api/user/favorite";
let param = {
type: 1,
favorite_id: that.id
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
if (that.yingyangdetail.is_favorite == 0) {
Toast('收藏成功')
that.yingyangdetail.is_favorite = 1;
that.yingyangdetailt = that.yingyangdetail
} else {
Toast('取消收藏成功')
that.yingyangdetail.is_favorite = 0;
that.yingyangdetail = that.yingyangdetail
}
})
.catch(function (err) {
console.log(err);
});
},
},
created() {
document.title = '唐元集公众号'
this.id = this.$route.query.id;
this.getdetail()
}
... ... @@ -41,5 +98,17 @@ export default {
.containerbox {
padding: 0.32rem;
box-sizing: border-box;
background: #fff;
}
.yingyangtitle {
color: #02170b;
font-size: 0.4rem;
}
.yingyangcontent {
color: #666e69;
font-size: 0.32rem;
}
.yingyangbox {
margin-top: 0.6rem;
}
</style>
\ No newline at end of file
... ...
... ... @@ -106,6 +106,9 @@ export default {
iszhibo: false
}
},
created() {
document.title = '唐元集公众号'
},
methods: {
overvideo() {
this.iszhibo = false
... ...
<template>
<div class="containerbox"></div>
</template>
<script>
import Vue from "vue";
import { getUrlKey } from "../../utils/utils.js";
... ...
<template>
<div class="containerbox">
<div class="flextwo sharetopk" @click="back">
<div class="leftrow leftrowkimg">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">发布</div>
<div class="sharebtn">
<!-- <img src="../../../assets/sharebtn.png" alt /> -->
</div>
</div>
<div class="topcontainer">
<div class="publishitem flextwo" @click="selectkind">
<div class="publeft flexone">
<div class="kindname">
<span class="kindleft">分类</span>
{{kindname}}
{{ kindname }}
</div>
</div>
... ... @@ -14,13 +23,14 @@
<div class="enterkind">
<textarea name id cols="30" rows="10" placeholder="请输入您的想法" v-model="kindidea"></textarea>
</div>
<!-- <div @click="uppic">上传图片</div> -->
<div>
<van-uploader
v-model="fileList"
multiple="true"
:after-read="afterRead"
:max-count="8"
:max-count="9"
@delete="deleftimg"
/>
... ... @@ -28,8 +38,21 @@
<img src="../../../assets/addpub.png" alt />
</div>-->
</div>
<div class="videoimgll">
<img src="../../../assets/upvideo.png" alt class="videoimgbtn" v-if="video_image==''" />
<img :src="video_image" alt v-else />
<div class="videoimgkk">
<input type="file" accept="video/*" @change="uploadfileone" />
</div>
<img src="../../../assets/anniu.png" alt class="listanniu" v-if="video_image!=''" />
</div>
<!-- <div class="pubimg"></div> -->
</div>
<van-loading type="spinner" color="#1989fa" v-if="cardzheng" />
<div class="kaishilu" @click="publish">发布</div>
<div class="pubpicker" v-if="showkind">
<van-picker
... ... @@ -51,9 +74,15 @@
</template>
<script>
import Vue from 'vue';
import { Picker, Uploader, Toast } from 'vant';
import Vue from "vue";
import wx from "weixin-js-sdk";
import "vant/lib/index.css";
console.log(wx);
import { Picker, Uploader, Toast, Loading } from "vant";
Vue.use(Loading);
Vue.use(Picker);
Vue.use(Toast);
Vue.use(Uploader);
... ... @@ -62,123 +91,173 @@ export default {
return {
columns: [],
showkind: false,
kindname: '请选择分类',
kindname: "请选择分类",
success: false,
kindidea: '',
kindidea: "",
fileList: [],
images: [],
chuanimage: [],
delimg: [],
sort: [],
sort_id: ''
}
sort_id: "",
chuanvideo: '',
showvideo: '',
video_image: '',
cardzheng: false
};
},
created() {
this.getkindlist()
document.title = "唐元集公众号";
this.getkindlist();
},
methods: {
uppic() {
console.log(3378378);
wx.ready(() => {
wx.chooseImage({
count: 1,
sizeType: ["compressed"], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
that.pic = localIds[0];
}
});
});
// 预览图片接;
// wx.uploadImage({
// localId: "", // 需要上传的图片的本地ID,由chooseImage接口获得
// isShowProgressTips: 1, // 默认为1,显示进度提示
// success: function(res) {
// var serverId = res.serverId; // 返回图片的服务器端ID
// }
// });
},
back() {
this.$router.go(-1);
},
selectkind() {
this.showkind = true
this.showkind = true;
},
onCancel() {
console.log(347344)
this.showkind = false
console.log(347344);
this.showkind = false;
},
onConfirm(value, index) {
console.log(78343784)
this.showkind = false
this.kindname = value
this.sort_id = this.sort[index].id
console.log(78343784);
this.showkind = false;
this.kindname = value;
this.sort_id = this.sort[index].id;
},
sure() {
this.success = false
this.success = false;
},
// 上传图片
afterRead(file) {
let that = this;
console.log(file)
console.log(file.length)
console.log(file);
console.log(file.length);
that.cardzheng = true
if (file.length == undefined) {
var formdata = new FormData();
formdata.append("file", file.file);
that.delimg.push(file.file.name)
that.delimg.push(file.file.name);
var url = "/api/common/upload";
let param = {
id: 1
}
that
.$uploadFile.post(url, formdata)
that.$uploadFile
.post(url, formdata)
.then(function (res) {
console.log(res);
that.cardzheng = false
that.cardzheng = false;
let url = "http://tangyuanji.t.brotop.cn" + res.data.url;
that.images.push(url);
that.chuanimage.push(res.data.url);
})
.catch(err => {
console.log(err);
});
} else {
for (var i = 0; i < file.length; i++) {
console.log(file[i].file)
console.log(file[i].file);
var formdata = new FormData();
formdata.append("file", file[i].file);
that.delimg.push(file[i].file.name)
that.delimg.push(file[i].file.name);
var url = "/api/common/upload";
that
.$uploadFile.post(url, formdata)
that.$uploadFile
.post(url, formdata)
.then(function (res) {
console.log(res);
that.cardzheng = false
that.cardzheng = false;
let url = "http://tangyuanji.t.brotop.cn" + res.data.url;
that.images.push(url);
that.chuanimage.push(res.data.url);
})
.catch(err => {
console.log(err);
that.cardzheng = false;
});
}
}
},
// 删除文件
deleftimg(e) {
let that = this;
let item = e.file.name
let item = e.file.name;
this.delimg.forEach(function (value, index, array) {
if (value == item) {
that.delimg.splice(index, 1);
that.images.splice(index, 1);
that.chuanimage.splice(index, 1);
that.fileList.splice(index, 1)
}
});
this.delimg = this.delimg
this.delimg = this.delimg;
this.images = this.images;
this.chuanimage = this.chuanimage;
this.$forceUpdate();
},
// 上传视频
uploadfileone(e) {
let that = this;
that.cardzheng = true
console.log(e);
let file = e.target.files[0];
console.log(file);
var formdata = new FormData();
formdata.append("file", file);
// formdata.append("token", localStorage.getItem("token"));
var url = "/api/common/upload";
that.$uploadFile
.post(url, formdata)
.then(function (res) {
console.log(res);
that.cardzheng = false
that.chuanvideo = res.data.url;
that.showvideo = res.data.priview_url;
that.video_image = res.data.video_image
})
.catch(err => {
that.cardzheng = false
console.log(err);
});
},
// 获取分类列表
getkindlist() {
let that = this;
var url = "/api/social/sort";
let param = {
};
let param = {};
that.$axios
.post(url, param)
... ... @@ -186,72 +265,118 @@ export default {
console.log(res);
let data = res.data;
data.forEach(function (value, index) {
that.columns.push(value.sort_name)
})
that.columns = that.columns
that.sort = res.data
that.columns.push(value.sort_name);
});
that.columns = that.columns;
that.sort = res.data;
})
.catch(function (err) {
console.log(err);
});
},
getvalue(value) {
console.log(value)
console.log(value);
},
// 发布
publish() {
let that = this;
var url = "/api/social/send";
if (that.sort_id == '') {
Toast("请选择分类")
return false
if (that.sort_id == "") {
Toast("请选择分类");
return false;
}
if (that.kindidea == '') {
Toast("请输入您的想法")
return false
if (that.kindidea == "") {
Toast("请输入您的想法");
return false;
}
if (that.chuanimage.length != that.fileList.length) {
Toast("图片上传中")
return false
Toast("图片上传中");
return false;
}
if (that.chuanvideo == '' && that.cardzheng == true) {
Toast("视频上传中");
return false;
}
let param = {
sort_id: that.sort_id,
description: that.kindidea,
images: that.chuanimage.join(",")
images: that.chuanimage.join(","),
video: that.chuanvideo
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
Toast("发布成功")
that.$router.go(-1)
Toast("发布成功");
that.$router.go(-1);
})
.catch(function (err) {
console.log(err);
});
}
}
}
};
</script>
<style scoped>
@import "../../../style/society.css";
.van-loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 99;
}
.topcontainer {
padding: 0 0.32rem;
box-sizing: border-box;
background: #fff;
padding-bottom: 0.32rem;
box-sizing: border-box;
margin-top: 0.8rem;
}
.kindleft {
color: #323233;
font-size: 0.28rem;
margin-right: 0.32rem;
}
.videoimgkk {
width: 1.58rem;
height: 1.58rem;
position: absolute;
left: 0;
top: 0;
}
.videoimgll {
width: 1.58rem;
height: 1.58rem;
position: relative;
display: flex;
justify-content: center;
align-items: center;
border: 1px dashed #999;
}
.videoimgkk input {
width: 100%;
height: 100%;
outline: none;
border: none;
opacity: 0;
/* background: transparent;
outline: none;
border: none; */
}
.listanniu {
width: 0.5rem;
height: 0.5rem;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.videoimgbtn {
width: 0.8rem;
height: 0.8rem;
}
</style>
... ...