You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

273 lines
8.1 KiB

3 years ago
// pages/quest/quest.js
3 years ago
import {http} from '../../../../../utils/util'
3 years ago
// import {DownloadSaveFile,downloadFile
// } from '../../../../../utils/downloadSaveFile.js'
3 years ago
Page({
/**
* 页面的初始数据
*/
data: {
3 years ago
cdn:getApp().globalData.cdn,
3 years ago
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:{},
3 years ago
isClick:false,
// imageUrl:"/pages/index/shortimage/img_xingtue@2x.png"
3 years ago
},
3 years ago
3 years ago
back(){
wx.navigateBack({
delta: 1
})
},
3 years ago
to(e) {
console.log(e.target.dataset.url)
wx.navigateTo({
url: e.target.dataset.url
})
},
//跳转详情
detail(e){
console.log(e)
wx.setStorageSync('info', e.currentTarget.dataset.cycle_id)
3 years ago
wx.navigateTo({
3 years ago
url:"/pages/index/subpage/brand/brandDetails/brandDetails"
3 years ago
})
3 years ago
},
//收藏
collection(e){
3 years ago
var that = this
3 years ago
let userId = this.data.infoObject.id
let referenceId = this.data.infoObject.id
3 years ago
// let referenceId = wx.getStorageSync('referenceId')
let isClick = this.data.isClick
3 years ago
console.log(e)
3 years ago
if(!isClick){
that.setData({
isClick:true
3 years ago
})
3 years ago
wx.showToast({
title: '收藏成功',
icon: 'none'
})
http("/userReference/add", "post", {userId,referenceId
}).then(res =>{
this.setData({
// userId:e.currentTarget.dataset.cycle_id,
// referenceId:this.id
})
})
}
3 years ago
},
3 years ago
3 years ago
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
title: '任务中心',
success: function (res) {}
})
3 years ago
this.setData({
type:options.type,
infoObject:wx.getStorageSync('info')
})
this.getrecordslist()
3 years ago
// var htmls =
// <dib><h1>解析</h1></dib>
// var that = this
// WxParse.wxParse('htmls','html',htmls,that,5);
3 years ago
},
getrecordslist(){
http("/topicActivity/list", "post", {
}).then(res =>{
this.setData({
records: res.data.records,
})
})
3 years ago
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
3 years ago
onShareAppMessage:function() {
3 years ago
var that = this
3 years ago
return {
3 years ago
title:that.data.infoObject.title,
path:"pages/index/subpage/brand/brandDetails/brandDetails",
// imageUrl:that.cdn+infoObject.cover,
3 years ago
}
3 years ago
3 years ago
},
//保存
preserve(){
3 years ago
// if(){
wx.showModal({
title: '提示',
content: '确定要保存吗?',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
wx.getImageInfo({
3 years ago
// src: '/pages/index/shortimage/img_xingtue@2x.png',
src:'',
3 years ago
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('用户点击取消')
}
}
})
// }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();
// }
// })
// }
// }
// })
// }
},
// downloadSaveFile(e) {
// let url = e.currentTarget.dataset.url;
// // 保存到相册
// DownloadSaveFile.downloadFile('video', url); //video或image
3 years ago
// }
3 years ago
})