0531 动态

master
liuyongli 3 years ago
parent 7dfd1fd522
commit 9419efc9cd

@ -1,7 +1,9 @@
// pages/quest/quest.js
import {http} from '../../../../../utils/util'
// import {DownloadSaveFile,downloadFile
// } from '../../../../../utils/downloadSaveFile.js'
import {
http
} from '../../../../../utils/util'
import {
cdn
} from '../../../../../utils/config'
Page({
/**
@ -10,72 +12,11 @@ Page({
data: {
cdn: getApp().globalData.cdn,
type: 0,
// questes: [
// {
// time: '2022-3-182022-5-18',
// title: '星途揽月新款抖音视频需求需要马上贯彻落实',
// text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
// url: 'https://www.oa00.com/#/attendance/index',
// type: 1,
// num: '258w',
// duration: '02:32',
// },{
// time: '2022-3-182022-5-18',
// title: '星途揽月新款抖音视频需求需要马上贯彻落实',
// text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
// url: 'https://www.oa00.com/#/attendance/index',
// type: 1,
// num: '258w',
// duration: '02:32',
// },{
// time: '2022-3-182022-5-18',
// title: '星途揽月新款抖音视频需求需要马上贯彻落实',
// text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
// url: 'https://www.oa00.com/#/attendance/index',
// type: 1,
// num: '258w',
// duration: '02:32',
// },{
// time: '2022-3-182022-5-18',
// title: '星途揽月新款抖音视频需求需要马上贯彻落实',
// text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
// url: 'https://www.oa00.com/#/attendance/index',
// type: 1,
// num: '258w',
// duration: '02:32',
// },{
// time: '2022-3-182022-5-18',
// title: '星途揽月新款抖音视频需求需要马上贯彻落实',
// text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
// url: 'https://www.oa00.com/#/attendance/index',
// type: 1,
// num: '258w',
// duration: '02:32',
// },{
// time: '2022-3-182022-5-18',
// title: '星途揽月新款抖音视频需求需要马上贯彻落实',
// text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
// url: 'https://www.oa00.com/#/attendance/index',
// type: 1,
// num: '258w',
// duration: '02:32',
// },{
// time: '2022-3-182022-5-18',
// title: '星途揽月新款抖音视频需求需要马上贯彻落实',
// text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
// url: 'https://www.oa00.com/#/attendance/index',
// type: 1,
// num: '258w',
// duration: '02:32',
// },
// ],
records: [],
questes:[],
infoObject: {},
isClick: false,
// imageUrl:"/pages/index/shortimage/img_xingtue@2x.png"
},
back() {
wx.navigateBack({
delta: 1
@ -114,7 +55,9 @@ to(e) {
title: '收藏成功',
icon: 'none'
})
http("/userReference/add", "post", {userId,referenceId
http("/userReference/add", "post", {
userId,
referenceId
}).then(res => {
this.setData({
// userId:e.currentTarget.dataset.cycle_id,
@ -123,13 +66,12 @@ to(e) {
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
title: '任务中心',
title: '动态详情',
success: function (res) {}
})
this.setData({
@ -137,16 +79,9 @@ to(e) {
infoObject: wx.getStorageSync('info')
})
this.getrecordslist()
// var htmls =
// <dib><h1>解析</h1></dib>
// var that = this
// WxParse.wxParse('htmls','html',htmls,that,5);
},
getrecordslist() {
http("/topicActivity/list", "post", {
}).then(res =>{
http("/topicActivity/list", "post", {}).then(res => {
this.setData({
records: res.data.records,
})
@ -208,66 +143,94 @@ to(e) {
},
//保存
preserve(){
// if(){
wx.showModal({
title: '提示',
content: '确定要保存吗?',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
preserve: function (e) {
console.log(this.data.infoObject.content)
wx.getImageInfo({
// src: '/pages/index/shortimage/img_xingtue@2x.png',
src:'',
success: function (res) {
console.log(res);
var path = res.path;
src: cdn + this.data.infoObject.content, //这里放你要下载图片的数组(多张) 或 字符串(一张) 下面代码不用改动
success: function (ret) {
var path = ret.path
wx.saveImageToPhotosAlbum({
filePath: path,
success: function (res) {
console.log('已保存');
success(result) {
console.log("成功");
wx.hideLoading();
wx.showToast({
title: '下载图片成功',
duration: 2000,
mask: true,
});
},
fail: function (res) {
console.log('保存失败');
fail(result) {
console.log("失败,你取消了" + JSON.stringify(result))
console.log(path);
wx.openSetting({
success: (res) => {
console.log(res);
}
})
}
});
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
// }else{
// wx.showLoading({
// title: '下载中...',
// })
// wx.downloadFile({
// //视频信息的Url
// url: app.serverUrl + me.data.videoInfo.videoPath,
// success: function (res) {
// // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
// if (res.statusCode === 200) {
// console.log(res.tempFilePath);
// wx.saveVideoToPhotosAlbum({
// filePath: res.tempFilePath,
// success:function(res) {
// console.log(res.errMsg)
// wx.hideLoading();
// }
// })
// }
// }
// })
});
},
//保存视频
handleDownload(e) {
let link = e.currentTarget.dataset.link;
let fileName = new Date().valueOf();
wx.downloadFile({
url: link,
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4',
success: res => {
console.log(res);
let filePath = res.filePath;
wx.saveVideoToPhotosAlbum({
filePath,
success: file => {
wx.showToast({
title: '下载视频成功',
duration: 2000,
mask: true,
});
let fileMgr = wx.getFileSystemManager();
fileMgr.unlink({
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4',
success: function (r) {
// }
},
// downloadSaveFile(e) {
// let url = e.currentTarget.dataset.url;
// // 保存到相册
// DownloadSaveFile.downloadFile('video', url); //video或image
// }
})
},
fail: err => {
console.log(err)
if (err.errMsg === 'saveVideoToPhotosAlbum:fail auth deny') {
wx.showModal({
title: '提示',
content: '需要您授权保存相册',
showCancel: false,
success: data => {
wx.openSetting({
success(settingdata) {
if (settingdata.authSetting['scope.writePhotosAlbum']) {
wx.showModal({
title: '提示',
content: '获取权限成功,再次点击下载即可保存',
showCancel: false,
})
} else {
wx.showModal({
title: '提示',
content: '获取权限失败,将无法保存到相册哦~',
showCancel: false,
})
}
},
})
}
})
}
}
})
}
})
},
})

@ -1,4 +1,3 @@
{
"usingComponents": {},
"navigationStyle": "custom"
"usingComponents": {}
}

@ -1,17 +1,17 @@
<!--pages/index/subpage/brand/brandDetails/brandDetails.wxml-->
<view class="video" wx:if="{{infoObject.type===1}}">
<video style="width: 100%; " initial-time='0.01' muted autoplay object-fit="cover" src="{{cdn+(infoObject.content)}}">
<l-icon name="left" color="black" size="48" class="back" bindtap="back" />
<!-- <l-icon name="left" color="black" size="48" class="back" bindtap="back" /> -->
</video>
</view>
<view class="video" wx:if="{{infoObject.type===2}}">
<image mode="widthFix" src="{{cdn+(infoObject.cover)}}" style="width: 100%;">
<l-icon name="left" color="black" size="48" class="back" bindtap="back" />
<!-- <l-icon name="left" color="black" size="48" class="back" bindtap="back" /> -->
</image>
</view>
<view class="video" wx:if="{{infoObject.type===3}}">
<image src="{{cdn+(infoObject.cover)}}" style="width: 100%;height: 100%;">
<l-icon name="left" color="black" size="48" class="back" bindtap="back" />
<!-- <l-icon name="left" color="black" size="48" class="back" bindtap="back" /> -->
</image>
</view>
<view class="main">
@ -37,7 +37,11 @@
<image src="../brandDetails/images/ic_shoucang@3x.png" style="width: 48rpx;height: 48rpx;vertical-align: middle;margin-right: 10rpx;"></image>
<text style="width: 48rpx;height: 48rpx;">{{isClick?'已收藏': '收藏'}}</text>
</view>
<view class="d-flex-list" bindtap="preserve">
<view class="d-flex-list" data-link="{{cdn+(infoObject.content)}}" bindtap="handleDownload" wx:if="{{infoObject.type===1}}">
<image src="../brandDetails/images/ic_baocun@3x.png" style="width: 48rpx;height: 48rpx;vertical-align: middle;margin-right: 10rpx;"></image>
<text>保存</text>
</view>
<view class="d-flex-list" bindtap="preserve" wx:else>
<image src="../brandDetails/images/ic_baocun@3x.png" style="width: 48rpx;height: 48rpx;vertical-align: middle;margin-right: 10rpx;"></image>
<text>保存</text>
</view>

Loading…
Cancel
Save