0531 动态

master
liuyongli 3 years ago
parent 7dfd1fd522
commit 9419efc9cd

@ -1,7 +1,9 @@
// pages/quest/quest.js import {
import {http} from '../../../../../utils/util' http
// import {DownloadSaveFile,downloadFile } from '../../../../../utils/util'
// } from '../../../../../utils/downloadSaveFile.js' import {
cdn
} from '../../../../../utils/config'
Page({ Page({
/** /**
@ -10,72 +12,11 @@ Page({
data: { data: {
cdn: getApp().globalData.cdn, cdn: getApp().globalData.cdn,
type: 0, 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: [], records: [],
questes:[],
infoObject: {}, infoObject: {},
isClick: false, isClick: false,
// imageUrl:"/pages/index/shortimage/img_xingtue@2x.png" // imageUrl:"/pages/index/shortimage/img_xingtue@2x.png"
}, },
back() { back() {
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
@ -114,7 +55,9 @@ to(e) {
title: '收藏成功', title: '收藏成功',
icon: 'none' icon: 'none'
}) })
http("/userReference/add", "post", {userId,referenceId http("/userReference/add", "post", {
userId,
referenceId
}).then(res => { }).then(res => {
this.setData({ this.setData({
// userId:e.currentTarget.dataset.cycle_id, // userId:e.currentTarget.dataset.cycle_id,
@ -123,13 +66,12 @@ to(e) {
}) })
} }
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: '任务中心', title: '动态详情',
success: function (res) {} success: function (res) {}
}) })
this.setData({ this.setData({
@ -137,16 +79,9 @@ to(e) {
infoObject: wx.getStorageSync('info') infoObject: wx.getStorageSync('info')
}) })
this.getrecordslist() this.getrecordslist()
// var htmls =
// <dib><h1>解析</h1></dib>
// var that = this
// WxParse.wxParse('htmls','html',htmls,that,5);
}, },
getrecordslist() { getrecordslist() {
http("/topicActivity/list", "post", { http("/topicActivity/list", "post", {}).then(res => {
}).then(res =>{
this.setData({ this.setData({
records: res.data.records, records: res.data.records,
}) })
@ -208,66 +143,94 @@ to(e) {
}, },
//保存 //保存
preserve(){ preserve: function (e) {
// if(){ console.log(this.data.infoObject.content)
wx.showModal({
title: '提示',
content: '确定要保存吗?',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
wx.getImageInfo({ wx.getImageInfo({
// src: '/pages/index/shortimage/img_xingtue@2x.png', src: cdn + this.data.infoObject.content, //这里放你要下载图片的数组(多张) 或 字符串(一张) 下面代码不用改动
src:'', success: function (ret) {
success: function (res) { var path = ret.path
console.log(res);
var path = res.path;
wx.saveImageToPhotosAlbum({ wx.saveImageToPhotosAlbum({
filePath: path, filePath: path,
success: function (res) { success(result) {
console.log('已保存'); console.log("成功");
wx.hideLoading();
wx.showToast({
title: '下载图片成功',
duration: 2000,
mask: true,
});
}, },
fail: function (res) { fail(result) {
console.log('保存失败'); console.log("失败,你取消了" + JSON.stringify(result))
console.log(path);
wx.openSetting({
success: (res) => {
console.log(res);
} }
}) })
} }
}); });
} else if (res.cancel) {
console.log('用户点击取消')
} }
} });
}) },
// }else{ //保存视频
// wx.showLoading({ handleDownload(e) {
// title: '下载中...', let link = e.currentTarget.dataset.link;
// }) let fileName = new Date().valueOf();
// wx.downloadFile({ wx.downloadFile({
// //视频信息的Url url: link,
// url: app.serverUrl + me.data.videoInfo.videoPath, filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4',
// success: function (res) { success: res => {
// // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 console.log(res);
// if (res.statusCode === 200) { let filePath = res.filePath;
// console.log(res.tempFilePath); wx.saveVideoToPhotosAlbum({
filePath,
// wx.saveVideoToPhotosAlbum({ success: file => {
// filePath: res.tempFilePath, wx.showToast({
// success:function(res) { title: '下载视频成功',
// console.log(res.errMsg) duration: 2000,
// wx.hideLoading(); 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; },
// // 保存到相册 fail: err => {
// DownloadSaveFile.downloadFile('video', url); //video或image 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": {}, "usingComponents": {}
"navigationStyle": "custom"
} }

@ -1,17 +1,17 @@
<!--pages/index/subpage/brand/brandDetails/brandDetails.wxml--> <!--pages/index/subpage/brand/brandDetails/brandDetails.wxml-->
<view class="video" wx:if="{{infoObject.type===1}}"> <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)}}"> <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> </video>
</view> </view>
<view class="video" wx:if="{{infoObject.type===2}}"> <view class="video" wx:if="{{infoObject.type===2}}">
<image mode="widthFix" src="{{cdn+(infoObject.cover)}}" style="width: 100%;"> <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> </image>
</view> </view>
<view class="video" wx:if="{{infoObject.type===3}}"> <view class="video" wx:if="{{infoObject.type===3}}">
<image src="{{cdn+(infoObject.cover)}}" style="width: 100%;height: 100%;"> <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> </image>
</view> </view>
<view class="main"> <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> <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> <text style="width: 48rpx;height: 48rpx;">{{isClick?'已收藏': '收藏'}}</text>
</view> </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> <image src="../brandDetails/images/ic_baocun@3x.png" style="width: 48rpx;height: 48rpx;vertical-align: middle;margin-right: 10rpx;"></image>
<text>保存</text> <text>保存</text>
</view> </view>

Loading…
Cancel
Save