Commit 26fbad9d by yuzhenWang

Merge branch 'test' into 'dev'

Test

See merge request !123
parents 97c9d950 21086680
...@@ -643,7 +643,7 @@ ...@@ -643,7 +643,7 @@
return data.map(item => { return data.map(item => {
// 创建 remarkName // 创建 remarkName
const remarkName = item.name ? const remarkName = item.name ?
(item.name.length > 3 ? item.name.substring(0, 3) + '...' : item.name) : (item.name.length > 5 ? item.name.substring(0, 5) + '...' : item.name) :
''; '';
// 创建新对象,保持原数据不变 // 创建新对象,保持原数据不变
...@@ -966,12 +966,12 @@ ...@@ -966,12 +966,12 @@
justify-content: space-between; justify-content: space-between;
margin-top: 20rpx; margin-top: 20rpx;
.left{ .left{
width: 76%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
.line{ .line{
width: 20%; width: 18%;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin-top: -40rpx; margin-top: -40rpx;
......
...@@ -378,7 +378,7 @@ export default { ...@@ -378,7 +378,7 @@ export default {
height: 100%; height: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: flex-start;
overflow: hidden; overflow: hidden;
.preview-image { .preview-image {
...@@ -493,7 +493,7 @@ export default { ...@@ -493,7 +493,7 @@ export default {
height: 100%; height: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: flex-start;
overflow: hidden; overflow: hidden;
.preview-image { .preview-image {
......
...@@ -91,7 +91,10 @@ ...@@ -91,7 +91,10 @@
<view class="tabContent"> <view class="tabContent">
<!-- 课程介绍 --> <!-- 课程介绍 -->
<view class="courseIntroContent" v-if="tabType===1" style="margin-top: 20rpx;"> <view class="courseIntroContent" v-if="tabType===1" style="margin-top: 20rpx;">
<view v-html="courseInfo.fileIntroduce" class="richTextContent"></view> <!-- <view v-html="courseInfo.fileIntroduce" class="richTextContent"></view> -->
<image class="imageStyle" v-for="(item,index) in imagesList" :key="index" style="width: 100%"
:src="item" mode="widthFix" @click="previewImage(index)">
</image>
</view> </view>
<!-- 服务流程 --> <!-- 服务流程 -->
<view class="courseIntroContent" v-if="tabType===4" style="margin-top: 20rpx;"> <view class="courseIntroContent" v-if="tabType===4" style="margin-top: 20rpx;">
...@@ -265,6 +268,7 @@ ...@@ -265,6 +268,7 @@
import loadingIcon from '@/components/loading/loading.vue'; import loadingIcon from '@/components/loading/loading.vue';
import ShareGuide from '@/components/ShareGuide/ShareGuide.vue'; import ShareGuide from '@/components/ShareGuide/ShareGuide.vue';
import wx from 'weixin-js-sdk' import wx from 'weixin-js-sdk'
import { previewImages } from '@/util/previewImage.js';
export default { export default {
components: { components: {
UniShareWx, UniShareWx,
...@@ -357,10 +361,22 @@ ...@@ -357,10 +361,22 @@
isOrderLoading: false, isOrderLoading: false,
posterShareTxt: '长按图片分享给朋友', posterShareTxt: '长按图片分享给朋友',
orderCodeUrl: '', orderCodeUrl: '',
posterImgType: 'sharePoster' posterImgType: 'sharePoster',
imagesList:[]
}; };
}, },
methods: { methods: {
previewImage (index) {
// 过滤掉无效的图片地址(空字符串或非http开头)
const validUrls = this.imagesList.filter(url => url && url.trim() !== '');
if (validUrls.length === 0) {
uni.showToast({ title: '暂无图片', icon: 'none' });
return;
}
// 确保索引有效
const idx = Math.min(index, validUrls.length - 1);
previewImages(validUrls, idx);
},
gotoJoinPartner() { gotoJoinPartner() {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'加盟', '加盟',
...@@ -782,6 +798,16 @@ ...@@ -782,6 +798,16 @@
} }
}) })
}, },
extractImageUrls(htmlString) {
if (!htmlString) return [];
const imgRegex = /<img[^>]+src=["']([^"']+)["']/g;
const urls = [];
let match;
while ((match = imgRegex.exec(htmlString)) !== null) {
urls.push(match[1]);
}
return urls;
},
// 课程详情页面 // 课程详情页面
courseDetail() { courseDetail() {
this.userId = uni.getStorageSync('cffp_userId') this.userId = uni.getStorageSync('cffp_userId')
...@@ -798,6 +824,10 @@ ...@@ -798,6 +824,10 @@
this.bannerViewType = "2"; this.bannerViewType = "2";
this.getBanner(Number(this.courseInfo.filePathOss)); this.getBanner(Number(this.courseInfo.filePathOss));
} }
if(this.courseInfo.fileIntroduce){
this.imagesList = this.extractImageUrls(this.courseInfo.fileIntroduce)
console.log(' this.imagesList', this.imagesList);
}
//this.courseInfo.serviceContent = res['data']['data']['filePathOss']; //this.courseInfo.serviceContent = res['data']['data']['filePathOss'];
this.lecturerId = res['data']['data']['fileLecturerId']; this.lecturerId = res['data']['data']['fileLecturerId'];
// this.lecturerQuery(); // this.lecturerQuery();
...@@ -1501,6 +1531,14 @@ ...@@ -1501,6 +1531,14 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.imageStyle {
display: block;
/* 将图像转为块级元素以去除底部空白 */
width: 100%;
/* 确保图像宽度适应容器 */
margin-top: -1rpx;
}
.container { .container {
width: 100%; width: 100%;
height: auto; height: auto;
......
...@@ -263,6 +263,7 @@ ...@@ -263,6 +263,7 @@
}; };
const initPdfAfterPermission = () => { const initPdfAfterPermission = () => {
console.log('initPdfAfterPermission执行了');
loading.value = true; loading.value = true;
const filteredTabs = filteredCurrentTabs.value; const filteredTabs = filteredCurrentTabs.value;
if (currentType.value >= 2 && currentType.value <= 4) { if (currentType.value >= 2 && currentType.value <= 4) {
......
...@@ -484,6 +484,9 @@ ...@@ -484,6 +484,9 @@
}, },
gotoPoster() { gotoPoster() {
if (!uni.getStorageSync('loginType') || uni.getStorageSync('loginType') == 'visitor') { if (!uni.getStorageSync('loginType') || uni.getStorageSync('loginType') == 'visitor') {
uni.redirectTo({
url:'/myPackageA/login/login'
})
uni.setStorageSync('loginType', 'visitor') uni.setStorageSync('loginType', 'visitor')
uni.setStorageSync('islogin', '1') uni.setStorageSync('islogin', '1')
} }
......
...@@ -138,6 +138,8 @@ ...@@ -138,6 +138,8 @@
console.log(e) console.log(e)
// error // error
} }
console.log('退出登录');
uni.clearStorageSync();
uni.redirectTo({ uni.redirectTo({
url:'/myPackageA/login/login' url:'/myPackageA/login/login'
}) })
......
/**
* 图片预览
* @param {String|Array} images - 图片列表,可以是字符串URL数组,或对象数组(需指定urlKey)
* @param {Number} current - 当前显示图片的索引(从0开始)
* @param {Object} options - 其他配置
* @param {String} options.urlKey - 当images为对象数组时,指定url字段名,默认 'url'
* @param {String} options.indicator - 指示器样式,可选 'default'、'number'、'none'
* @param {Boolean} options.loop - 是否循环播放,默认 false
*/
export function previewImages(images, current = 0, options = {}) {
const { urlKey = 'url', indicator = 'default', loop = false } = options;
// 统一转换为字符串数组
let urls = [];
if (Array.isArray(images)) {
if (typeof images[0] === 'string') {
urls = images;
} else if (typeof images[0] === 'object') {
urls = images.map(item => item[urlKey]);
}
} else if (typeof images === 'string') {
urls = [images];
}
if (urls.length === 0) {
console.warn('预览图片列表为空');
return;
}
// 确保 current 在有效范围
const index = Math.min(Math.max(current, 0), urls.length - 1);
console.log('urls',urls);
uni.previewImage({
urls,
current: index,
indicator,
loop,
// 长按可自定义菜单,但一般使用默认
// 支持 success/fail/complete 回调
});
}
\ No newline at end of file
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