| | |
| | | */ |
| | | data: { |
| | | agreementFalg: false, |
| | | tempPath: '', |
| | | primary: '', |
| | | bottomLift: 0, |
| | | |
| | |
| | | phone: res.data |
| | | }).then((res) => { |
| | | if (res.code == 200) { |
| | | const tempPath = wx.getStorageSync('tempPath') || '' |
| | | const { tempPath } = this.data |
| | | wx.setStorageSync('member', res.data) |
| | | if (tempPath) { |
| | | wx.setStorageSync('tempPath', '') |
| | | if (tempPath == '/pages/webView/index') { |
| | | wx.navigateTo({ |
| | | url: '/pages/webView/index', |
| | |
| | | }, |
| | | onLoad(options) { |
| | | var app = getApp().globalData |
| | | |
| | | this.setData({ |
| | | primary: app.primary |
| | | }) |
| | | this.initData() |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | const tempPath = wx.getStorageSync('tempPath') || '' |
| | | this.setData({tempPath}) |
| | | setTimeout(() => { |
| | | wx.setStorageSync('tempPath', '') |
| | | }) |
| | | |
| | | }, |
| | | |
| | |
| | | info |
| | | } = this.data |
| | | console.log('点击了分享') |
| | | return { |
| | | path: '/pages/detailDis/case?id=' + info.id + '&userId=' + info.users.id |
| | | if(info.users && info.users.id){ |
| | | return { |
| | | path: '/pages/detailDis/case?id=' + info.id + '&userId=' + info.users.id |
| | | } |
| | | }else{ |
| | | return { |
| | | path: '/pages/detailDis/case?id=' + info.id |
| | | } |
| | | } |
| | | }, |
| | | handleAction(e) { |
| | |
| | | onShareAppMessage: function () { |
| | | let { info } = this.data |
| | | console.log('点击了分享') |
| | | return { |
| | | path: '/pages/detailDis/product?id=' + info.id + '&userId=' + info.users.id |
| | | if(info.users && info.users.id){ |
| | | return { |
| | | path: '/pages/detailDis/product?id=' + info.id + '&userId=' + info.users.id |
| | | } |
| | | }else{ |
| | | return { |
| | | path: '/pages/detailDis/product?id=' + info.id |
| | | } |
| | | } |
| | | }, |
| | | onClose() { |
| | |
| | | // this.setData({showShare: false}) |
| | | // }) |
| | | }, |
| | | // onShareAppMessage: function () { |
| | | // // let { productDetail, userInfo } = this.data |
| | | // return { |
| | | // title: productDetail.title, |
| | | // path: '/pages/index/index?id=' + productDetail.id + '&shareuserid=' + userInfo.id + '&type=0' |
| | | // } |
| | | // }, |
| | | onClose() { |
| | | this.setData({ |
| | | showShare: false |
| | |
| | | info |
| | | } = this.data |
| | | console.log('点击了分享') |
| | | return { |
| | | path: '/pages/detailDis/realpic?id=' + info.id + '&userId=' + info.users.id |
| | | if(info.users && info.users.id){ |
| | | return { |
| | | path: '/pages/detailDis/realpic?id=' + info.id + '&userId=' + info.users.id |
| | | } |
| | | }else{ |
| | | return { |
| | | path: '/pages/detailDis/realpic?id=' + info.id |
| | | } |
| | | } |
| | | }, |
| | | }) |
| | |
| | | export const saveShareRecord = (data) => { |
| | | return request({ |
| | | url: '/web/customer/saveShareRecord?id='+data, |
| | | data |
| | | data, |
| | | loading: '0' |
| | | }) |
| | | } |
| | | // 产品视频 |
| | |
| | | } |
| | | }, |
| | | fail(err) { |
| | | item.paddingStatus = 4 |
| | | that.setData({ |
| | | downloadList |
| | | }) |
| | | wx.showToast({ |
| | | title: '图片下载失败',icon: 'none' |
| | | }) |
| | |
| | | customer |
| | | } = this.data |
| | | const enjoyList = wx.getStorageSync('enjoyList') || [] |
| | | if (!customer.customerId) return wx.showToast({ |
| | | if (!customer.platSourceId) return wx.showToast({ |
| | | title: '请先选择要关联的客户', |
| | | icon: 'none' |
| | | }) |
| | |
| | | import { newsPage,saveShareRecord } from '../../api/index' |
| | | import { |
| | | newsPage, |
| | | saveShareRecord |
| | | } from '../../api/index' |
| | | import moment from "moment"; |
| | | Page({ |
| | | |
| | |
| | | this.getList() |
| | | }, |
| | | getList() { |
| | | newsPage({capacity:this.data.capacity, |
| | | page:this.data.page, |
| | | model:{type:0}}) |
| | | .then(res =>{ |
| | | wx.stopPullDownRefresh() |
| | | if(this.data.page ==1){ |
| | | this.setData({list:[]}) |
| | | newsPage({ |
| | | capacity: this.data.capacity, |
| | | page: this.data.page, |
| | | model: { |
| | | type: 0 |
| | | } |
| | | if(this.data.page == res.data.page){ |
| | | res.data.records.forEach(element => { |
| | | element.createDate = moment(element.createDate).format("yyyy/MM/DD") |
| | | }) |
| | | .then(res => { |
| | | wx.stopPullDownRefresh() |
| | | if (this.data.page == 1) { |
| | | this.setData({ |
| | | list: [] |
| | | }) |
| | | this.setData({list: [...this.data.list, ...res.data.records || []], |
| | | total:res.data.total}) |
| | | } |
| | | } |
| | | if (this.data.page == res.data.page) { |
| | | res.data.records.forEach(element => { |
| | | element.createDate = moment(element.createDate).format("yyyy/MM/DD") |
| | | }) |
| | | this.setData({ |
| | | list: [...this.data.list, ...res.data.records || []], |
| | | total: res.data.total |
| | | }) |
| | | } |
| | | console.log(this.data) |
| | | }) |
| | | }) |
| | | }, |
| | | onReady() { |
| | | |
| | |
| | | }, |
| | | onReachBottom() { |
| | | console.log('触底事件'); |
| | | const { total, list, page } = this.data |
| | | if(total > list.length){ |
| | | this.setData({ page: page + 1 }) |
| | | const { |
| | | total, |
| | | list, |
| | | page |
| | | } = this.data |
| | | if (total > list.length) { |
| | | this.setData({ |
| | | page: page + 1 |
| | | }) |
| | | this.getList() |
| | | }else{ |
| | | } else { |
| | | wx.showToast({ |
| | | title: '暂无更多数据', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | downfile(e){ |
| | | const item = e.currentTarget.dataset.index; |
| | | downfile(e) { |
| | | const item = e.currentTarget.dataset.index; |
| | | saveShareRecord(item.id) |
| | | const files = [] |
| | | if(item.fileType ==1 && item.fileList && item.fileList.length && item.fileList[0].fileurlFull ){ |
| | | if (item.fileType == 1 && item.fileList && item.fileList.length && item.fileList[0].fileurlFull) { |
| | | files.push(item.fileList[0].fileurlFull) |
| | | } |
| | | if(item.fileType !=1 && item.fileList && item.fileList.length ){ |
| | | item.fileList.forEach(ee => { |
| | | if(ee.fileurlFull){ |
| | | files.push(ee.fileurlFull) |
| | | } |
| | | }) |
| | | if (item.fileType != 1 && item.fileList && item.fileList.length) { |
| | | item.fileList.forEach(ee => { |
| | | if (ee.fileurlFull) { |
| | | files.push(ee.fileurlFull) |
| | | } |
| | | }) |
| | | } |
| | | if(item.fileType ==1){ |
| | | this.downloadVideoFileDo(files,item.title) |
| | | }else{ |
| | | this.downloadImageFileDo(files,item.title) |
| | | } |
| | | if (item.fileType == 1) { |
| | | this.downloadVideoFileDo(files, item.title) |
| | | } else { |
| | | this.downloadImageFileDo(files, item.title) |
| | | } |
| | | }, |
| | | downloadImageFileDo(files,title){ |
| | | downloadImageFileDo(files, title) { |
| | | wx.showLoading({ |
| | | title: '正在下载', |
| | | mask: true |
| | | }) |
| | | let temp = 0; |
| | | if(files.length){ |
| | | for(let i = 0;i<files.length;i++){ |
| | | let filePath = wx.env.USER_DATA_PATH + '/' + new Date().valueOf()+i + '.jpg' ; |
| | | let temp = 0; |
| | | let count = 0; |
| | | if (files.length) { |
| | | for (let i = 0; i < files.length; i++) { |
| | | let filePath = wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + i + '.jpg'; |
| | | wx.downloadFile({ |
| | | url: files[i], |
| | | filePath: filePath, |
| | | timeout:180000, |
| | | success: function (res) { |
| | | timeout: 180000, |
| | | success: function (res) { |
| | | var tempFp = res.filePath |
| | | wx.saveImageToPhotosAlbum({ |
| | | filePath: tempFp, |
| | | success(result) { |
| | | temp ++; |
| | | console.log(result) |
| | | if(temp == files.length){ |
| | | wx.hideLoading(); |
| | | wx.setClipboardData({ |
| | | data: title, |
| | | success: function (res) { |
| | | wx.getClipboardData({ |
| | | success: function (res) { |
| | | wx.showToast({ |
| | | title: '文案已复制成功,去分享吧' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }, fail(err) { |
| | | wx.showToast({ |
| | | title: '图片下载失败哦' |
| | | }) |
| | | } |
| | | }) |
| | | } , fail(err) { |
| | | wx.showToast({ |
| | | title: '图片下载失败哦' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | downloadVideoFileDo(files,title){ |
| | | wx.showLoading({ |
| | | title: '正在下载', |
| | | }) |
| | | if(files.length){ |
| | | let filePath = wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + '0.mp4'; |
| | | wx.downloadFile({ |
| | | url: files[0], |
| | | filePath: filePath, |
| | | timeout:180000, |
| | | success: function (res) { |
| | | var tempFp = res.filePath |
| | | wx.saveVideoToPhotosAlbum({ |
| | | filePath: tempFp, |
| | | success(result) { |
| | | console.log(result) |
| | | wx.hideLoading(); |
| | | temp++; |
| | | count++; |
| | | if (count == files.length) { |
| | | wx.hideLoading() |
| | | } |
| | | if (temp == files.length) { |
| | | wx.setClipboardData({ |
| | | data: title, |
| | | data: title, |
| | | success: function (res) { |
| | | wx.getClipboardData({ |
| | | success: function (res) { |
| | |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, fail(err) { |
| | | }) |
| | | } |
| | | }, |
| | | fail(err) { |
| | | count++; |
| | | if (count == files.length) { |
| | | wx.hideLoading() |
| | | } |
| | | wx.showToast({ |
| | | title: '图片下载失败哦' |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | fail(err) { |
| | | count++; |
| | | if (count == files.length) { |
| | | wx.hideLoading() |
| | | } |
| | | wx.showToast({ |
| | | title: '图片下载失败哦' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }else{ |
| | | wx.showToast({ |
| | | title: '该资讯暂无可分享的图片或视频', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | downloadVideoFileDo(files, title) { |
| | | wx.showLoading({ |
| | | title: '正在下载', |
| | | mask: true |
| | | }) |
| | | let count = 0; |
| | | if (files.length) { |
| | | let filePath = wx.env.USER_DATA_PATH + '/' + new Date().valueOf() + '0.mp4'; |
| | | wx.downloadFile({ |
| | | url: files[0], |
| | | filePath: filePath, |
| | | timeout: 180000, |
| | | success: function (res) { |
| | | var tempFp = res.filePath |
| | | wx.saveVideoToPhotosAlbum({ |
| | | filePath: tempFp, |
| | | success(result) { |
| | | count++; |
| | | if (count == files.length) { |
| | | wx.hideLoading() |
| | | } |
| | | wx.setClipboardData({ |
| | | data: title, |
| | | success: function (res) { |
| | | wx.getClipboardData({ |
| | | success: function (res) { |
| | | wx.showToast({ |
| | | title: '文案已复制成功,去分享吧' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | fail(err) { |
| | | count++; |
| | | if (count == files.length) { |
| | | wx.hideLoading() |
| | | } |
| | | wx.showToast({ |
| | | title: '视频下载失败哦' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | fail(err) { |
| | | count++; |
| | | if (count == files.length) { |
| | | wx.hideLoading() |
| | | } |
| | | wx.showToast({ |
| | | title: '视频下载失败哦' |
| | | }) |
| | | } |
| | | }) |
| | | }else{ |
| | | wx.showToast({ |
| | | title: '该资讯暂无可分享的图片或视频', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | console.log('下拉刷新') |
| | | this.setData({ page: 1 }) |
| | | this.getList() |
| | | console.log('下拉刷新') |
| | | this.setData({ |
| | | page: 1 |
| | | }) |
| | | this.getList() |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |