fixbug: 修改实名认证&咨询的bug
This commit is contained in:
+59
-47
@@ -5,13 +5,13 @@
|
||||
<view class="ID_card_upload">
|
||||
<view class="upload_item" @click="phoneFun('Z')">
|
||||
<up-image
|
||||
:src="fileListZ && Object.keys(fileListZ).length !== 0 ? fileListZ.accessUrl : 'https://static.tbmall.xin/static/ID_rx.png'"
|
||||
:src="fileListZ && fileListZ.accessUrl ? fileListZ.accessUrl : 'https://static.tbmall.xin/static/ID_rx.png'"
|
||||
width="100%" height="90" bgColor="#f1f6ff00"></up-image>
|
||||
<view class="upload_msg">点击上传身份证人像面</view>
|
||||
</view>
|
||||
<view class="upload_item" @click="phoneFun('F')">
|
||||
<up-image
|
||||
:src="fileListF && Object.keys(fileListF).length !== 0 ? fileListF.accessUrl : 'https://static.tbmall.xin/static/ID_gq.png'"
|
||||
:src="fileListF && fileListF.accessUrl ? fileListF.accessUrl : 'https://static.tbmall.xin/static/ID_gq.png'"
|
||||
width="100%" height="90" bgColor="#f1f6ff00"></up-image>
|
||||
<view class="upload_msg">点击上传身份国旗面</view>
|
||||
</view>
|
||||
@@ -24,7 +24,7 @@
|
||||
<view class="templ_img_item_msg">
|
||||
<up-image :src="item.isOk ? '/static/common/ID_ok_1.png' : '/static/common/ID_error.png'"
|
||||
width="10" height="10" bgColor="#f1f6ff00"></up-image>
|
||||
<view class="templ_img_item_msg_title">{{ item.title }}111</view>
|
||||
<view class="templ_img_item_msg_title">{{ item.title }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -72,54 +72,61 @@ export default {
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
Fimg(p, r) {
|
||||
if (p) {
|
||||
this.fileListZ = { accessUrl: p };
|
||||
}
|
||||
Fimg: {
|
||||
handler(p) {
|
||||
if (p) {
|
||||
this.fileListZ = { accessUrl: p };
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
Bimg(p, r) {
|
||||
if (p) {
|
||||
this.fileListF = { accessUrl: p };
|
||||
}
|
||||
Bimg: {
|
||||
handler(p) {
|
||||
if (p) {
|
||||
this.fileListF = { accessUrl: p };
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
deletePic(event) {
|
||||
this.fileListZ.splice(event.index, 1);
|
||||
},
|
||||
phoneFun(type) {
|
||||
let that = this;
|
||||
console.log('aaaaaaa')
|
||||
/*#ifdef MP*/
|
||||
uni.chooseMedia({
|
||||
count: 1, // 默认为1,摄像头拍照为1,录像为10,录音为1
|
||||
mediaType: ['image'], // 可以指定是摄像头还是录像,这里两者都支持
|
||||
sourceType: ['camera'], // 可以指定来源是相册还是相机,这里只选相机
|
||||
camera: 'back', // 可以指定使用前置还是后置摄像头,默认后置
|
||||
success: (imgRes) => {
|
||||
// 成功则返回文件的本地临时文件路径
|
||||
const filePath = imgRes.tempFiles[0].tempFilePath; // 获取文件路径
|
||||
that.uploadFile(filePath, type);
|
||||
const that = this;
|
||||
// #ifdef MP-WEIXIN
|
||||
if (uni.chooseMedia) {
|
||||
uni.chooseMedia({
|
||||
count: 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: ['album', 'camera'],
|
||||
camera: 'back',
|
||||
success: (imgRes) => {
|
||||
if (imgRes.tempFiles && imgRes.tempFiles.length > 0) {
|
||||
const filePath = imgRes.tempFiles[0].tempFilePath;
|
||||
that.uploadFile(filePath, type);
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('chooseMedia error:', err);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
if (res.tempFilePaths && res.tempFilePaths.length > 0) {
|
||||
const filePath = res.tempFilePaths[0];
|
||||
that.uploadFile(filePath, type);
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
// 处理错误
|
||||
console.error(err);
|
||||
console.error('chooseImage error:', err);
|
||||
}
|
||||
});
|
||||
/*#endif*/
|
||||
/*#ifndef MP*/
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认9,设置图片的数量
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success: function (res) {
|
||||
// 成功选择图片后
|
||||
const filePath = res.tempFilePaths[0]; // 获取文件路径
|
||||
that.uploadFile(filePath, type);
|
||||
}
|
||||
});
|
||||
/*#endif*/
|
||||
|
||||
},
|
||||
uploadFile(url, type) {
|
||||
uni.showLoading({
|
||||
@@ -140,18 +147,23 @@ export default {
|
||||
'HSM-AUTH': token ? token : '',
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
const data = JSON.parse(uploadFileRes.data);
|
||||
if (data.bizcode === 100) {
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(uploadFileRes.data);
|
||||
} catch (e) {
|
||||
data = uploadFileRes.data;
|
||||
}
|
||||
if (data && data.bizcode === 100) {
|
||||
if (type === "Z") {
|
||||
that.fileListZ = data.data;
|
||||
this.$emit("valueFunc", "Z", data.data.dbUrl);
|
||||
that.$emit("valueFunc", "Z", data.data.dbUrl);
|
||||
} else if (type === "F") {
|
||||
that.fileListF = data.data;
|
||||
this.$emit("valueFunc", "F", data.data.dbUrl);
|
||||
that.$emit("valueFunc", "F", data.data.dbUrl);
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '图片上传失败',
|
||||
title: (data && data.msg) || '图片上传失败',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration: 3000,
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
<view class="title_">{{ newsDetail.title }}</view>
|
||||
<view class="avatar_">
|
||||
<view>
|
||||
<up-image :src="newsDetail.avatar_url" width="40" height="40" bgColor="#f1f6ff00" shape="circle"></up-image>
|
||||
<up-image :src="newsDetail.avatar_url" width="40" height="40" bgColor="#f1f6ff00"
|
||||
shape="circle"></up-image>
|
||||
</view>
|
||||
<view style="margin-left: 12rpx;">{{ newsDetail.name }}</view>
|
||||
</view>
|
||||
@@ -14,14 +15,17 @@
|
||||
<view>{{ formatDate(newsDetail.ctdate) }}</view>
|
||||
<view class="browses_">
|
||||
<view>
|
||||
<up-image src="/pages/login_package/static/login/show.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
|
||||
<up-image src="/pages/login_package/static/login/show.png" width="20" height="20"
|
||||
bgColor="#f1f6ff00"></up-image>
|
||||
</view>
|
||||
<view style="margin-left: 8rpx;">{{ newsDetail.browses }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="news_info_fg_warp"></view>
|
||||
<view class="news_info_content_warp" v-html="newsDetail.content"></view>
|
||||
<view class="news_info_content_warp">
|
||||
<up-parse :content="formattedContent" :tagStyle="{ img: 'max-width:100% !important;height:auto !important;display:block;margin:10rpx auto;' }"></up-parse>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -38,6 +42,23 @@ export default {
|
||||
newsDetail: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formattedContent() {
|
||||
if (!this.newsDetail || !this.newsDetail.content) return '';
|
||||
let content = this.newsDetail.content;
|
||||
// 兼容小程序富文本:给所有 img 注入自适应宽度样式,避免原图过大导致横向滚动
|
||||
content = content.replace(/<img[^>]*>/gi, (match) => {
|
||||
if (/style\s*=\s*["'][^"']*["']/i.test(match)) {
|
||||
return match.replace(/style\s*=\s*(["'])([^"']*)\1/i, (m, quote, val) => {
|
||||
return `style=${quote}${val};max-width:100% !important;height:auto !important;display:block;margin:10rpx auto;${quote}`;
|
||||
});
|
||||
} else {
|
||||
return match.replace(/<img/i, '<img style="max-width:100% !important;height:auto !important;display:block;margin:10rpx auto;"');
|
||||
}
|
||||
});
|
||||
return content;
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
const id = option.id;
|
||||
if (id && id !== "null") {
|
||||
@@ -104,7 +125,10 @@ export default {
|
||||
.news_info_content_warp {
|
||||
padding: 30rpx;
|
||||
height: calc(100vh - 524rpx);
|
||||
overflow: auto;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
box-sizing: border-box;
|
||||
word-break: break-all;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user