123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- var app=getApp();
- var utils=require("../../../utils/http");
- const util=require("../../../utils/util")
- let videoContext=null;
- var customerflag=false,stoptime=0;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- imgUrl: app.globalData.imgUrl,
- videoUrl:'',
- video_id:'',
- title:'',
- btflag:false,
- loginFlag:false,
- phoneFlag:false,
- errorText:'请求错误!',
- oneButton: [{text: '确定'}],
- ght:'100%',
- customers_num: "",
- hot: "",
- video_url: "",
- headimgurl: "",
- nickname: "",
- vid: "",
- star_num: "",
- editVideoFlag: true,
- shareuserid: "",
- videoflag:false,
- playBtn:true,
- collectflag:0,
- startY:0,
- endY:0,
- type:'',
- videoObj:{},
- mobileflag:false,
- autoplay:true,
- covercustomerFlag:true,
- alertFlag:false,
- alerText:'',
- footflag:false,
- personMsg:app.globalData.personMsg,
- companyobj:app.globalData.companyobj,
- nowflag:false,
- wshareshow:false,
- showDsc: false,
- priceflag: false,
- controlShow: false,
- playflag: 2,//1是播放中,2是暂停,3是加载中
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- var that=this;
- that.setData({
- video_id:options.vid
- })
- wx.showLoading({
- title: '加载中...',
- })
- that.sharemsg();
- },
- setpostertap: function () {
- wx.navigateTo({
- url: '/index/pages/setposter/setposter?type=video&aid='+this.data.video_id+"&listshare=",
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- /**
- * 弹出报价弹窗
- */
- priceshowtap() {
- this.setData({
- priceflag: true
- })
- },
- /**
- * 关闭报价弹窗
- */
- closepricetap() {
- this.setData({
- priceflag: false
- })
- },
- showdscMsg: function () {
- if (this.data.videoObj.description.length > 28) {
- this.data.showDsc = !this.data.showDsc;
- this.setData({
- showDsc: this.data.showDsc
- })
- }
- },
- wsharetap:function(e){
- var that=this;
- that.setData({
- wshareshow:true,
- })
- },
- shareurltap:function(e){
- var that=this;
- wx.showLoading({
- title: '加载中...',
- })
- util.schemefun('/share/pages/videoshare/videoshare','vid='+that.data.video_id +'&userid='+app.globalData.personMsg.id+'&ctp='+app.globalData.clientype,that.data.video_id,'video','');
- this.sharelogtap();
- },
- sendfriendtap(){
- this.sharelogtap();
- },
- sharelogtap:function(){
- var that=this;
- this.setData({
- nowflag:false,
- })
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data: {
- id:that.data.video_id,
- type:'video'
- },
- success: function (r) {
- }
- })
- },
- collecTap:function(){
- var that=this;
- var vurl='';
- var videoObj=that.data.videoObj;
- if(videoObj.collect=='0'){
- vurl="api/video/collect"
- }else{
- vurl="api/video/collectCancel"
- }
-
- utils.$post({
- url: app.globalData.webUrl + vurl,
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- id: that.data.video_id,
- },
- success: function (res) {
- if (res.data.code == "0") {
- if(videoObj.collect=='0'){
- videoObj.collect=1;
- that.setData({
- videoObj:videoObj,
- alertFlag:true,
- alerText:res.data.msg
- })
- setTimeout(function(){
- that.setData({
- alertFlag:false,
- })
- },1000)
- }else{
- videoObj.collect=0;
- that.setData({
- videoObj:videoObj,
- alertFlag:true,
- alerText:res.data.msg
- })
- setTimeout(function(){
- that.setData({
- alertFlag:false,
- })
- },1000)
- }
- } else {
- if(res.data.msg=='您已收藏'){
- videoObj.collect=1;
- that.setData({
- videoObj:videoObj
- })
- }
- }
- }
- })
- },
- sharemsg:function(){
- var that=this;
- utils.$post({
- url: app.globalData.webUrl + 'api/video/info',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data: {
- video_id:that.data.video_id
- },
- success: function (r) {
-
- if(r.data.code=='0'){
- r.data.data.video_url=r.data.data.video_url;
- r.data.data.description = r.data.data.title + '#' + r.data.data.description + '#';
- that.setData({
- title:r.data.data.title,
- videoObj:r.data.data,
- autoplay:true
- })
- wx.setNavigationBarTitle({
- title: r.data.data.title
- })
- const videoContext = that.selectComponent('#myVideo');
- videoContext.play();
- }
- wx.hideLoading()
- }
- })
- },
- signpricetap(){
- wx.showToast({
- title: "您是员工无需报价!",
- icon: 'none',
- duration: 2000
- })
- },
- prelooktap(){
- if(!app.globalData.personMsg.binded.qrcode){
- wx.showToast({
- title: "您的二维码为空,请上传二维码!",
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- wx.previewImage({
- current: app.globalData.imgUrl+app.globalData.personMsg.binded.qrcode, // 当前显示图片的http链接
- urls: [app.globalData.imgUrl+app.globalData.personMsg.binded.qrcode]// 需要预览的图片http链接列表
- })
- },
- callphonetap:function(){
- wx.makePhoneCall({
- phoneNumber: app.globalData.personMsg.phone
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.setData({
- personMsg:app.globalData.personMsg,
- companyobj:app.globalData.companyobj,
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- onShareAppMessage: function () {
- this.sharelogtap();
- var img=this.data.videoObj.cover?this.data.videoObj.cover:(this.data.videoObj.video_url+'?x-oss-process=video/snapshot,t_100,f_jpg,w_500,m_fast');
- return {
- title: this.data.videoObj.title,
- imageUrl: img,
- path: '/share/pages/videoshare/videoshare?vid='+this.data.video_id+'&userid='+app.globalData.personMsg.id+'&ctp='+app.globalData.clientype
- }
- }
- })
|