123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- const util = require("../../../utils/util.js");
- Page({
- data: {
- wheelId:'',
- content:'',
- imagelist:[],
- theam:'redContent',
- showQrcode:false,
- video:[]
- },
- onLoad: function (options) {
- if (!util.isEmpty(options.wheelId)) {
- this.setData({
- wheelId:options.wheelId
- })
- this.getHtml()
- }
- if (!util.isEmpty(options.theam)) {
- this.setData({theam:options.theam})
- }
- },
- onReady: function () {
- },
- onShow: function () {
- },
- // 点击图片放大
- lookImg(e) {
- let picurl = e.currentTarget.dataset.pic
- let urls = [];
- // urls.push(data)
- urls = this.data.content.sharePisList
- wx.previewImage({
- current: picurl, // 当前显示图片的http链接
- urls: urls // 需要预览的图片http链接列表
- });
- },
- // 复制内容
- copyContent(e){
- let that=this,article=e.currentTarget.dataset.article;
- wx.setClipboardData({
- data: article,
- success: function (res) {
- console.log(res)
- }
- })
- },
- // 复制图片
- savePic(e){
- let self = this,picList=e.currentTarget.dataset.pic;
- picList.forEach((el,index) => {
- wx.downloadFile({
- url:el,
- success(res) {
- wx.saveImageToPhotosAlbum({
- filePath:res.tempFilePath,
- success:(res)=>{
- setTimeout(() => {
- util.showTips('已保存至相册!')
- }, 100);
- }
- })
- },
- fail(res){
- util.showTips('保存失败!')
- }
- })
- });
- },
- getHtml(){
- let that=this;
- util.ajax({
- func: "v2/market/wheel/info",
- data: {wheelId:that.data.wheelId}
- }, function (res) {
- if (res.code==0) {
- let data = res.data;
- data.rules = data.rules.replace(/section/g, "div");
- data.rules = data.rules.replace(/<img/g, "<img style='max-width:100%'");
-
- data.description = data.description.replace(/section/g, "div");
- data.description = data.description.replace(/<img/g, "<img style='max-width:100%'");
-
- let str = data.description.match(/<source src="(\S*)"/g);
- if (str) {
- let video = [];
- for (let i in str) {
- if (i < 3) {//只显示三个视频
- let src = str[i].match(/<source src="(\S*)"/)[1];
- video.push(src.toString())
- }
- }
- that.setData({ video });
- }
- that.setData({content:data})
- } else {
- util.showTips(res.reason);
- }
- })
- },
- // 跳转至发圈证明页
- jumpPage(){
- wx.navigateTo({
- url: `/pages/turntable/hairpin/index?flag=1`,
- })
- },
- // 联系客服
- connect(){
- this.setData({showQrcode:true})
- },
- // 关闭弹窗
- closeTip(e){
- this.setData({showQrcode:e.detail.status})
- },
- onShareAppMessage: function () {
- }
- })
|