123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431 |
- var app = getApp();
- var utils = require("../../../utils/http");
- const util = require("../../../utils/util")
- let videoContext = null;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- imgUrl: app.globalData.imgUrl,
- videoUrl: '',
- video_id: '',
- title: '',
- btflag: false,
- loginFlag: false,
- phoneFlag: false,
- showTask: true,
- datashow: 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: '',
- bType: "",
- pType: "",
- footflag: false,
- personMsg: app.globalData.personMsg,
- companyobj: app.globalData.companyobj,
- nowflag: false,
- wshareshow: false,
- showDsc: false,
- priceflag: false,
- controlShow: false,
- playflag: 2,//1是播放中,2是暂停
- isBroker: false,
- loading: false,
- showApproval: false,
- isfullScreen: false,
- remark: "",
- trackimgarr: [],
- nowimagearr: [],
- shareApprovallist: []
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if (!!options.clg && options.clg == 2) {
- wx.reLaunch({
- url: '/pages/index/index?clientype=' + options.cty + "&cid=" + options.cid + "&clg=2",
- })
- return false;
- }
- var that = this;
- that.setData({
- video_id: options.vid
- })
- if (!!options.ty) {
- this.setData({
- bType: options.ty,
- showTask: false
- })
- }
- if (!!options.tp) {
- this.setData({
- pType: options.tp
- })
- }
- if (app.globalData.brokeruserId) {
- that.setData({
- isBroker: true
- })
- } else {
- that.setData({
- isBroker: false
- })
- }
- wx.showLoading({
- title: '加载中...',
- })
- that.sharemsg();
- },
- getPhoneNumberTap: function (res) {
- var that = this;
- if (res.detail.errMsg == 'getPhoneNumber:ok') {
- that.setData({
- loading: true,
- })
- utils.$post({
- url: app.globalData.webUrl + 'api/users/setUserMobile',
- data: {
- encryptedData: res.detail.encryptedData,
- iv: res.detail.iv
- },
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- success: function (r) {
- if (r.data.code == '0') {
- that.submitMsg(r.data.mobile);
- }
- }
- })
- }
- },
- /**
- * 提交注册数据
- */
- submitMsg(mobile) {
- var that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/agents/add_agents',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- name: '',
- phone: mobile,
- employee_id: app.globalData.brokerEmployeeId,
- wechat: '',
- type: app.globalData.brokerType
- },
- success: function (res) {
- if (res.data.code == '0') {
- app.globalData.brokeruserId = res.data.data;
- that.setData({
- isBroker: true,
- loading: false,
- wshareshow: true
- })
- }
- }
- })
- },
- onFullScreenChange(e) {
- let isBol = e.detail.detail.fullScreen;
- this.setData({
- isfullScreen: isBol
- })
- },
- setpostertap: function () {
- if (this.data.bType == 'b') {
- wx.navigateTo({
- url: '/index/pages/setposter/setposter?type=video&aid=' + this.data.video_id + "&ty=b&listshare=",
- })
- } else {
- wx.navigateTo({
- url: '/index/pages/setposter/setposter?type=video&aid=' + this.data.video_id + "&listshare=",
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 弹出报价弹窗
- */
- priceshowtap() {
- videoContext.pause();
- 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,
- })
- },
- videotap() {
- videoContext.play();
- wx.showLoading()
- },
- bindprogress() {
- setTimeout(() => {
- wx.hideLoading();
- },2000)
- this.setData({
- playflag: 1
- })
- },
- shareurltap: function (e) {
- var that = this;
- wx.showLoading({
- title: '加载中...',
- })
- if (this.data.bType == 'b') {
- util.schemefun('/share/pages/videoshare/videoshare', 'vid=' + that.data.video_id + '&userid=' + app.globalData.agentEmployeEid + '&ctp=' + app.globalData.clientype + '&agid=' + app.globalData.brokeruserId, that.data.video_id, 'video', '');
- } else {
- 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
- })
- videoContext = that.selectComponent('#myVideo');
- videoContext.play();
- }
- setTimeout(() => {
- wx.hideLoading()
- },2000)
- }
- })
- },
- 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 () {
- var img = this.data.videoObj.cover_share_img?this.data.videoObj.cover_share_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');
- if (this.data.bType == 'b') {
- this.sharelogtap();
- return {
- title: this.data.videoObj.title,
- imageUrl: img,
- path: '/share/pages/videoshare/videoshare?vid=' + this.data.video_id + '&userid=' + app.globalData.agentEmployeEid + '&ctp=' + app.globalData.clientype + '&agid=' + app.globalData.brokeruserId
- }
- } else {
- this.sharelogtap();
- 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
- }
- }
- },
- onAddToFavorites(res) {
- var img = this.data.videoObj.cover_share_img?this.data.videoObj.cover_share_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,
- query: 'cid=' + this.data.video_id + '&cty=' + app.globalData.clientype + '&clg=2',
- }
- }
- })
|