diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 2d582c7..a49f89a 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -34,7 +34,7 @@
文章
-
+
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index bd6aa71..849ec10 100644
--- a/pages/index/index.wxss
+++ b/pages/index/index.wxss
@@ -104,12 +104,13 @@
.brand_card{
height: 246rpx;
+ /* width: 320rpx; */
}
.brand_voa {
/* background-color: royalblue; */
height: 202rpx;
- width: 304rpx;
+ width: 304rpx;
border-radius: 8rpx;
}
diff --git a/pages/index/subpage/brand/brandDetails/brandDetails.js b/pages/index/subpage/brand/brandDetails/brandDetails.js
index ab0c9d9..5842149 100644
--- a/pages/index/subpage/brand/brandDetails/brandDetails.js
+++ b/pages/index/subpage/brand/brandDetails/brandDetails.js
@@ -1,121 +1,64 @@
-// 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({
/**
* 页面的初始数据
*/
data: {
- cdn:getApp().globalData.cdn,
- type:0,
- // questes: [
- // {
- // time: '2022-3-18~2022-5-18',
- // title: '星途揽月新款抖音视频需求需要马上贯彻落实',
- // text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
- // url: 'https://www.oa00.com/#/attendance/index',
- // type: 1,
- // num: '258w',
- // duration: '02:32',
- // },{
- // time: '2022-3-18~2022-5-18',
- // title: '星途揽月新款抖音视频需求需要马上贯彻落实',
- // text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
- // url: 'https://www.oa00.com/#/attendance/index',
- // type: 1,
- // num: '258w',
- // duration: '02:32',
- // },{
- // time: '2022-3-18~2022-5-18',
- // title: '星途揽月新款抖音视频需求需要马上贯彻落实',
- // text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
- // url: 'https://www.oa00.com/#/attendance/index',
- // type: 1,
- // num: '258w',
- // duration: '02:32',
- // },{
- // time: '2022-3-18~2022-5-18',
- // title: '星途揽月新款抖音视频需求需要马上贯彻落实',
- // text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
- // url: 'https://www.oa00.com/#/attendance/index',
- // type: 1,
- // num: '258w',
- // duration: '02:32',
- // },{
- // time: '2022-3-18~2022-5-18',
- // title: '星途揽月新款抖音视频需求需要马上贯彻落实',
- // text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
- // url: 'https://www.oa00.com/#/attendance/index',
- // type: 1,
- // num: '258w',
- // duration: '02:32',
- // },{
- // time: '2022-3-18~2022-5-18',
- // title: '星途揽月新款抖音视频需求需要马上贯彻落实',
- // text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
- // url: 'https://www.oa00.com/#/attendance/index',
- // type: 1,
- // num: '258w',
- // duration: '02:32',
- // },{
- // time: '2022-3-18~2022-5-18',
- // title: '星途揽月新款抖音视频需求需要马上贯彻落实',
- // text: '以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上以一流的设计和领先的技术为基础以人工智能为差异化,从外观、性能上...',
- // url: 'https://www.oa00.com/#/attendance/index',
- // type: 1,
- // num: '258w',
- // duration: '02:32',
- // },
- // ],
- records:[],
- questes:[],
- infoObject:{},
- isClick:false,
+ cdn: getApp().globalData.cdn,
+ type: 0,
+ records: [],
+ infoObject: {},
+ isClick: false,
// imageUrl:"/pages/index/shortimage/img_xingtue@2x.png"
},
-
- back(){
+ back() {
wx.navigateBack({
delta: 1
})
},
-to(e) {
- console.log(e.target.dataset.url)
- wx.navigateTo({
- url: e.target.dataset.url
- })
+ to(e) {
+ console.log(e.target.dataset.url)
+ wx.navigateTo({
+ url: e.target.dataset.url
+ })
-},
+ },
//跳转详情
- detail(e){
+ detail(e) {
console.log(e)
wx.setStorageSync('info', e.currentTarget.dataset.cycle_id)
wx.navigateTo({
- url:"/pages/index/subpage/brand/brandDetails/brandDetails"
+ url: "/pages/index/subpage/brand/brandDetails/brandDetails"
})
-
+
},
//收藏
- collection(e){
+ collection(e) {
var that = this
let userId = this.data.infoObject.id
let referenceId = this.data.infoObject.id
// let referenceId = wx.getStorageSync('referenceId')
let isClick = this.data.isClick
console.log(e)
- if(!isClick){
+ if (!isClick) {
that.setData({
- isClick:true
+ isClick: true
})
wx.showToast({
title: '收藏成功',
icon: 'none'
})
- http("/userReference/add", "post", {userId,referenceId
- }).then(res =>{
+ http("/userReference/add", "post", {
+ userId,
+ referenceId
+ }).then(res => {
this.setData({
// userId:e.currentTarget.dataset.cycle_id,
// referenceId:this.id
@@ -123,30 +66,22 @@ to(e) {
})
}
},
-
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
- title: '任务中心',
+ title: '动态详情',
success: function (res) {}
})
this.setData({
- type:options.type,
- infoObject:wx.getStorageSync('info')
+ type: options.type,
+ infoObject: wx.getStorageSync('info')
})
this.getrecordslist()
- // var htmls =
- // 解析
- // var that = this
- // WxParse.wxParse('htmls','html',htmls,that,5);
-
-
},
- getrecordslist(){
- http("/topicActivity/list", "post", {
- }).then(res =>{
+ getrecordslist() {
+ http("/topicActivity/list", "post", {}).then(res => {
this.setData({
records: res.data.records,
})
@@ -198,75 +133,104 @@ to(e) {
/**
* 用户点击右上角分享
*/
- onShareAppMessage:function() {
+ onShareAppMessage: function () {
var that = this
return {
- title:that.data.infoObject.title,
- path:"pages/index/subpage/brand/brandDetails/brandDetails",
- // imageUrl:that.cdn+infoObject.cover,
+ title: that.data.infoObject.title,
+ path: "pages/index/subpage/brand/brandDetails/brandDetails",
+ // imageUrl:that.cdn+infoObject.cover,
}
},
//保存
- preserve(){
- // if(){
- wx.showModal({
- title: '提示',
- content: '确定要保存吗?',
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- wx.getImageInfo({
- src: '/pages/index/shortimage/img_xingtue@2x.png',
- success: function (res) {
- console.log(res);
- var path = res.path;
- wx.saveImageToPhotosAlbum({
- filePath: path,
- success: function (res) {
- console.log('已保存');
- },
- fail: function (res) {
- console.log('保存失败');
- }
- })
- }
- });
- } else if (res.cancel) {
- console.log('用户点击取消')
+ preserve: function (e) {
+ console.log(this.data.infoObject.content)
+ wx.getImageInfo({
+ src: cdn + this.data.infoObject.content, //这里放你要下载图片的数组(多张) 或 字符串(一张) 下面代码不用改动
+ success: function (ret) {
+ var path = ret.path
+ wx.saveImageToPhotosAlbum({
+ filePath: path,
+ success(result) {
+ console.log("成功");
+ wx.hideLoading();
+ wx.showToast({
+ title: '下载图片成功',
+ duration: 2000,
+ mask: true,
+ });
+ },
+ fail(result) {
+ console.log("失败,你取消了" + JSON.stringify(result))
+ console.log(path);
+ wx.openSetting({
+ success: (res) => {
+ console.log(res);
}
+ })
}
- })
- // }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) {
+
+ },
+ })
+ },
+ 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,
+ })
+ }
+ },
+ })
+ }
+ })
+ }
+ }
+ })
+ }
+ })
},
- // downloadSaveFile(e) {
- // let url = e.currentTarget.dataset.url;
- // // 保存到相册
- // DownloadSaveFile.downloadFile('video', url); //video或image
- // }
})
\ No newline at end of file
diff --git a/pages/index/subpage/brand/brandDetails/brandDetails.json b/pages/index/subpage/brand/brandDetails/brandDetails.json
index 965b8e8..8835af0 100644
--- a/pages/index/subpage/brand/brandDetails/brandDetails.json
+++ b/pages/index/subpage/brand/brandDetails/brandDetails.json
@@ -1,4 +1,3 @@
{
- "usingComponents": {},
- "navigationStyle": "custom"
+ "usingComponents": {}
}
\ No newline at end of file
diff --git a/pages/index/subpage/brand/brandDetails/brandDetails.wxml b/pages/index/subpage/brand/brandDetails/brandDetails.wxml
index 489374b..8ae4eb7 100644
--- a/pages/index/subpage/brand/brandDetails/brandDetails.wxml
+++ b/pages/index/subpage/brand/brandDetails/brandDetails.wxml
@@ -1,17 +1,17 @@
-
-
+
+
-
+
@@ -37,7 +37,11 @@
{{isClick?'已收藏': '收藏'}}
-
+
+
+ 保存
+
+
保存
diff --git a/pages/index/subpage/brand/brandDetails/brandDetails.wxss b/pages/index/subpage/brand/brandDetails/brandDetails.wxss
index 4b17053..5cf46e9 100644
--- a/pages/index/subpage/brand/brandDetails/brandDetails.wxss
+++ b/pages/index/subpage/brand/brandDetails/brandDetails.wxss
@@ -8,7 +8,8 @@
.video {
width: 100%;
- height: 440rpx;
+ /* height: 440rpx; */
+ height: 100%;
}