Commit 0605e2ff authored by sujie@126.com's avatar sujie@126.com

dd

parent 96d3f9fe
......@@ -137,7 +137,7 @@ function onlinecoursesverifypwd (data) {
return wxRequest({
url: apis.customer.websiteindex.onlinecoursesverifypwd,
data,
method: 'GET',
method: 'POST',
errorresolve: 1,
})
}
......
......@@ -945,4 +945,15 @@ Page({
})
})
},
// 课件图片
prevContentImg (e) {
const {dataset} = e.currentTarget;
const current = dataset.src;
const images = this.data.coursesDetail.content.images;
wxPreviewImage({
urls: [current],
current: current,
type: 'media'
})
},
})
\ No newline at end of file
......@@ -5,11 +5,11 @@
<view class="media-box">
<block wx:if="{{coursesDetail.hasInputPwd && coursesDetail.content}}">
<view class="image-box" wx:if="{{coursesDetail.content.type == 1 || coursesDetail.content.type == 4 || coursesDetail.content.type == 5}}">
<swiper indicator-dots="{{swiperSetting.indicatorDots}}" bindchange="imageSwiperChange" autoplay="{{swiperSetting.autoplay}}" interval="{{swiperSetting.interval}}" duration="{{swiperSetting.duration}}">
<swiper style="height: 392rpx;" indicator-dots="{{swiperSetting.indicatorDots}}" bindchange="imageSwiperChange" autoplay="{{swiperSetting.autoplay}}" interval="{{swiperSetting.interval}}" duration="{{swiperSetting.duration}}">
<block wx:for="{{coursesDetail.content.images}}" wx:key="{{index}}">
<swiper-item style="height: 392rpx;">
<view class="swiper-item">
<image class="" wx:if="{{index == 0 || (index >= imageCurrent-3 && index <= imageCurrent+3) }}" src="{{coursesDetail.content.type == 1 ? filter.imagify(item, 'image/resize,w_400/format,jpg/quality,q_60') : filter.mediaPng(item, 'image/resize,w_400/format,jpg/quality,q_60')}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" />
<view class="swiper-item" bindtap="prevContentImg" data-src="{{item}}">
<image class="" wx:if="{{index == 0 || (index >= imageCurrent-3 && index <= imageCurrent+3) }}" src="{{coursesDetail.content.type == 1 ? filter.imagify(item, 'image/resize,w_400/format,jpg/quality,q_100') : filter.mediaPng(item, 'image/resize,w_400/format,jpg/quality,q_100')}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" />
</view>
</swiper-item>
</block>
......
......@@ -79,7 +79,28 @@ function imagify(src, params) {
}
return _src;
}
function mediaimagify(src, params) {
console.log(src,'src')
var reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/g;
if (reg.test(src)) {
return src;
}
if (!src) return;
var _src = src;
if (src.indexOf('//tmp') != -1) {
return _src;
}
if (src.indexOf('media.shangjiadao.cn') == -1) {
_src = 'https://media.shangjiadao.cn/' + src;
}
if(src.indexOf('x-oss-process') != -1){
return _src;
}
if (params) {
_src = _src + '?x-oss-process=' + params;
}
return _src;
}
function timestampToTime(timestamp) {
var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
......@@ -472,5 +493,6 @@ export {
voiceTimeFormat,
getFlatternDistance,
copyContent,
debounce
debounce,
mediaimagify
}
\ No newline at end of file
import {
imagify
imagify,
mediaimagify
} from './index.js';
import {
constants
......@@ -247,8 +248,8 @@ function wxSaveImageToPhotosAlbum ({filePath}) {
}
function wxPreviewImage (data) {
let _urls = data.urls || [];
_urls = _urls.map(ele => imagify(ele));
let _current = imagify(data.current);
_urls = _urls.map(ele => data.type&&data.type == 'media' ? mediaimagify(ele) : imagify(ele));
let _current = data.type&&data.type == 'media' ? mediaimagify(data.current) :imagify(data.current);
return new Promise((reslve, reject) => {
wx.previewImage({
current: _current, // 当前显示图片的http链接
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment