Commit dcfcec7b authored by Facius's avatar Facius

feat: 同步收据通内容(自定义印章、公章上传、用户签字)

parent 04635d65
Pipeline #6220 canceled with stages
...@@ -207,3 +207,20 @@ export async function collectionMember(data) { ...@@ -207,3 +207,20 @@ export async function collectionMember(data) {
noLoading: true noLoading: true
}) })
} }
export async function getSealList() {
return request({
url: `/rest/repair/sealList`,
method: 'GET',
noLoading: true
})
}
export async function madeSeal(data) {
return request({
url: `/rest/user/madeSeal`,
method: 'POST',
data,
noLoading: true
})
}
import request from "@/utils/request.js"
export function getList(data) {
return request({
url: `/rest/anno/help`,
method: 'GET',
data,
noLoading:true,
})
}
// 全部已读
export function getDetail() {
return request({
url: `/rest/msg/mark`,
method: 'POST',
noLoading:true,
})
}
<template>
<UploadImages
ref="upload-images"
:max-count="maxCount"
:width="width"
:height="height"
custom-btn
:file-list="fileList"
:auto-upload="autoUpload"
:show-progress="false"
:show-add="showAdd"
:show-upload-list="showUploadList"
@on-list-change="handleListChange"
@on-choose-fail="onChooseFail"
>
<view v-if="$slots.addBtn" slot="addBtn" class="slot-view" hover-class="slot-btn__hover"><slot name="addBtn" /></view>
<view v-else slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" :style="slotStyle" hover-stay-time="150">
<u-icon name="plus" :size="addSize" color="#D8D8D8"></u-icon>
</view>
<PopInput
title="提醒"
type="text"
sureText="前往设置"
cancelText="返回"
:showCancel="true"
:content="uploadConent"
:visible.sync="showConfirm"
@cancel="handleCancel"
@click="handleConfirm"
/>
</UploadImages>
</template>
<script>
import PopInput from '@/components/pop-input-view';
import upload from '@/utils/upload';
import UploadImages from '@/components/upload/u-upload';
import { getQiNiuToken } from '@/api/common/index.js';
import { UPLOAD_FILE_HOST } from '@/utils/config.js';
import permision from '@/js_sdk/wa-permission/permission.js';
import { mapGetters } from 'vuex';
import { showModal } from '@/utils/auth.js';
export default {
components: {
UploadImages,
PopInput
},
props: {
// 给fileList赋初始值用
list: {
type: Array,
default() {
return [];
}
},
// 最大上传数量
maxCount: {
type: [String, Number],
default: 9
},
// 是否自动上传
autoUpload: {
type: Boolean,
default: false
},
// 内部预览图片区域和选择图片按钮的区域宽度
width: {
type: [String, Number],
default: 160
},
// 内部预览图片区域和选择图片按钮的区域高度
height: {
type: [String, Number],
default: 160
},
addSize: {
type: [String, Number],
default: 48
},
uploading: {
type: Boolean,
default: false
},
showAdd: {
type: Boolean,
default: true
}
},
data() {
return {
fileList: [],
qiniuToken: '',
showUploadList: false,
uploadConent: '需要使用相机权限,请前往设置。',
showConfirm: false,
};
},
computed: {
...mapGetters(['platform', 'isIOS']),
keyList() {
let list = [];
if (this.fileList.length) {
for (var item of this.fileList) {
if (item.key) {
list.push(item.key);
}
}
}
return list;
},
slotStyle() {
return ` width:${this.width}rpx;height:${this.height}rpx;`;
}
},
watch: {
list(val) {
if (val && !this.fileList.length) {
this.fileList = [];
for (var item of val) {
this.fileList.push({
key: item,
url: item
});
}
}
}
},
created() {
this.getQiniuToken();
},
methods: {
filterList(listA, listB) {
listA = listA || [];
listB = listB || [];
let list = [];
for (var item of listA) {
for (var obj of listB) {
if (obj.url == item.url) {
item.key = obj.key;
}
}
list.push(item);
}
return list;
},
handleListChange(lists, name) {
if (!lists || !lists.length) {
return false;
}
let newImages = lists;
this.$emit('update:uploading', true);
upload
.uploads(newImages, this.qiniuToken)
.then(res => {
let list = [];
if (res) {
for (var item of res) {
list.push(UPLOAD_FILE_HOST + item.key);
}
}
this.$emit('on-list-change', list);
console.log('upload:', this.fileList.length, this.keyList.length);
this.$emit('update:uploading', this.fileList.length != this.keyList.length);
this.$refs['upload-images'].clear();
})
.catch(msg => {
console.log(msg);
});
},
getQiniuToken() {
getQiNiuToken().then(res => {
if (res.data) {
this.qiniuToken = res.data;
}
});
},
selectFile() {
// 触发选择图片;不能改文件名,外部要调
this.$refs['upload-images'].selectFile();
},
onChooseFail(error){
console.log("onChooseFail:",error);
let {errCode}=error
if(errCode===11){
if (this.platform === '4' ) {
this.appAskAuth()
}
}
},
async appAskAuth() {
console.log('appAskAuth');
try {
if(this.isIOS){
let res =await permision.judgeIosPermissionPhotoLibrary();
if (!res) {
this.showConfirm = true;
}
}else{
let res=await permision.requestAndroidPermission('android.permission.CAMERA');
console.log('appAskAuth:res',res);
if (res!==1) {
showModal({
content:this.uploadConent,
callback:()=>{
this.handleConfirm()
}
})
}
}
} catch (e) {
console.log(e);
//TODO handle the exception
}
},
handleConfirm() {
permision.gotoAppPermissionSetting();
},
handleCancel() {
}
}
};
</script>
<style lang="scss" scoped>
/deep/.u-add-tips {
height: 0 !important;
margin-top: 0 !important;
overflow: hidden;
}
.slot-btn {
width: 160rpx;
height: 160rpx;
display: flex;
justify-content: center;
align-items: center;
background: #f6f7fa;
border-radius: 10rpx;
// margin: 10rpx;
}
.slot-btn__hover {
background-color: rgb(235, 236, 238);
}
</style>
This diff is collapsed.
...@@ -52,6 +52,7 @@ export default { ...@@ -52,6 +52,7 @@ export default {
onUnload() { onUnload() {
uni.$off(`input-sure-${this.editType}`); uni.$off(`input-sure-${this.editType}`);
uni.$off(this.chooseType); uni.$off(this.chooseType);
uni.$off('maintain-bill-choose-remark');
}, },
methods: { methods: {
choose(item){ choose(item){
......
...@@ -149,11 +149,30 @@ ...@@ -149,11 +149,30 @@
</view> </view>
</view> </view>
<particulars-record v-if="!isRefund" ref="particulars-record" :faultRecord="faultRecord" :showRecord.sync="showRecord"></particulars-record> <particulars-record v-if="!isRefund" ref="particulars-record" :faultRecord="faultRecord" :showRecord.sync="showRecord"></particulars-record>
<view class="part-one-view"> <!-- <view class="part-one-view">
<view class="item-one-view"> <view class="item-one-view">
<view class="label-view">红色水印(有效电子凭证)</view> <view class="label-view">红色水印(有效电子凭证)</view>
<view class="value-view"><u-switch v-model="form.showSeal" active-color="#02a074" inactive-color="#CCCCCC" @change="handleChangeShowSeal"></u-switch></view> <view class="value-view"><u-switch v-model="form.showSeal" active-color="#02a074" inactive-color="#CCCCCC" @change="handleChangeShowSeal"></u-switch></view>
</view> </view>
</view> -->
<view class="part-one-view">
<view class="item-one-view">
<view class="label-view">是否需要客户签字</view>
<view class="value-view"><u-switch v-model="form.extend.customerSignSwitch" active-color="#02a074"
inactive-color="#CCCCCC" @change="handleChangeShowSign"></u-switch></view>
</view>
</view>
<view class="part-view">
<view class="label-view">选择印章种类</view>
<view class="seal-type-view">
<view class="seal-type-view-item" :class="{ active: item.value == form.extend.sealType }" v-for="(item, index) in sealList" :key="index" @click="sealTypeChange(item)">
<view class="seal-type-view-item-icon" :style="{width:item.width,height:item.height}" v-if="item.url">
<image :src="item.url" mode=""></image>
</view>
<text>{{ item.label }}</text>
</view>
</view>
</view> </view>
</view> </view>
<submit-button <submit-button
...@@ -180,6 +199,8 @@ ...@@ -180,6 +199,8 @@
<DateRangePicker ref="date-range" type="date" :clear-icon="false" v-model="form.repairTime"><view style="left:200%"></view></DateRangePicker> <DateRangePicker ref="date-range" type="date" :clear-icon="false" v-model="form.repairTime"><view style="left:200%"></view></DateRangePicker>
<particulars-create ref="particulars-create" @openUnit="openUnit" @submit="particularsCreate"></particulars-create> <particulars-create ref="particulars-create" @openUnit="openUnit" @submit="particularsCreate"></particulars-create>
<PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该明细?" :visible.sync="showDeletePopup" @click="handleConfirmDelete" /> <PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该明细?" :visible.sync="showDeletePopup" @click="handleConfirmDelete" />
<PopInput title="提醒" type="text" sureText="确定" content="未上传我的印章,是否跳转至收据设置,上传印章" :visible.sync="showSealPopup"
@cancel="handleCancelSeal" @click="handleConfirmSeal" />
<unit-popup ref="unit-popup" :unit="unit" @change="handleChangeUnit"></unit-popup> <unit-popup ref="unit-popup" :unit="unit" @change="handleChangeUnit"></unit-popup>
</view> </view>
</template> </template>
...@@ -196,14 +217,15 @@ import ParticularsView from './components/particulars-view.vue'; ...@@ -196,14 +217,15 @@ import ParticularsView from './components/particulars-view.vue';
import ParticularsCreate from './components/particulars-create.vue'; import ParticularsCreate from './components/particulars-create.vue';
import ParticularsRecord from './components/particulars-record.vue'; import ParticularsRecord from './components/particulars-record.vue';
import UnitPopup from '@/components/unit-popup/unit-popup.vue'; import UnitPopup from '@/components/unit-popup/unit-popup.vue';
import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import { getSetting, random_string } from '@/utils/common.js'; import { getSetting, random_string } from '@/utils/common.js';
import { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js'; import { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js';
import { repairDetail, editeRepair, createOrUpdateService } from '@/api/maintain/index.js'; import { repairDetail, editeRepair, createOrUpdateService,getSealList } from '@/api/maintain/index.js';
import { formatCount } from '@/utils/common.js'; import { formatCount } from '@/utils/common.js';
import { billBaseUrl } from '@/utils/config.js'; import { billBaseUrl } from '@/utils/config.js';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { sealOptions } from '@/utils/options/maintain-bill/index.js';
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
...@@ -216,12 +238,14 @@ export default { ...@@ -216,12 +238,14 @@ export default {
ParticularsCreate, ParticularsCreate,
ParticularsRecord, ParticularsRecord,
SubmitButton, SubmitButton,
UnitPopup UnitPopup,
CheckboxGroups
}, },
data() { data() {
return { return {
unit: '', unit: '',
showDeletePopup: false, showDeletePopup: false,
showSealPopup: false,
loading: false, loading: false,
uploading: false, uploading: false,
form: { form: {
...@@ -237,7 +261,12 @@ export default { ...@@ -237,7 +261,12 @@ export default {
attach: [], attach: [],
type: '', // 收据样式 type: '', // 收据样式
expenseDetails: [], // 服务明细 expenseDetails: [], // 服务明细
showSeal: true showSeal: true,
extend: {
sealType: "1",
sealUrl: "https://static-book.kaying.cc/icon/dianzishuiyin1@3x.png",
customerSignSwitch: false
}
}, },
showDatePicker: false, showDatePicker: false,
showTimePicker: false, showTimePicker: false,
...@@ -271,7 +300,13 @@ export default { ...@@ -271,7 +300,13 @@ export default {
label: '请输入检查结果' label: '请输入检查结果'
} }
], ],
chooseMemberImage: billBaseUrl + 'tiaozhuantongxunlu@3x.png' chooseMemberImage: billBaseUrl + 'tiaozhuantongxunlu@3x.png',
sealList: sealOptions, // 印章列表
checkboxCustomStyle: {
width: '200rpx',
height: '128rpx'
},
jumpToSeal:false
}; };
}, },
computed: { computed: {
...@@ -427,7 +462,7 @@ export default { ...@@ -427,7 +462,7 @@ export default {
this.form.type = options.type; this.form.type = options.type;
} }
this.freshing = false; this.freshing = false;
this.getSealList() // 获取印章列表
if (this.billId || this.copyId) { if (this.billId || this.copyId) {
this.repairDetail(this.billId || this.copyId); this.repairDetail(this.billId || this.copyId);
} }
...@@ -450,7 +485,6 @@ export default { ...@@ -450,7 +485,6 @@ export default {
}, },
onUnload() { onUnload() {
uni.$off('maintain-bill-detail'); uni.$off('maintain-bill-detail');
uni.$off('maintain-bill-choose-remark');
}, },
onShow() {}, onShow() {},
methods: { methods: {
...@@ -542,7 +576,7 @@ export default { ...@@ -542,7 +576,7 @@ export default {
this.$refs['receipt-preview'].open(); this.$refs['receipt-preview'].open();
}, },
chooseRemark() { chooseRemark() {
uni.$on('maintain-bill-choose-remark', res => { uni.$once('maintain-bill-choose-remark', res => {
this.form.remark = res.remark; this.form.remark = res.remark;
}); });
uni.navigateTo({ uni.navigateTo({
...@@ -589,6 +623,62 @@ export default { ...@@ -589,6 +623,62 @@ export default {
} }
}); });
}, },
handleChangeShowSign() {},
async getSealList() {
try {
let res = await getSealList()
console.log(res)
res.data.map(item => {
this.sealList.map(seal=>{
if (item.value === seal.value) {
seal.url=item.url
}
})
})
} catch (e) {
console.log(e)
//TODO handle the exception
}
},
sealTypeChange(e) {
this.form.extend.sealType = e.value;
this.form.extend.sealUrl = e.url;
if (e.value === '2' && !e.url) {
this.showSealPopup = true
}
},
async resetSeal() {
let sealType = this.form.extend.sealType
if (sealType !== '2') {
return;
}
await this.getSealList();
this.sealList.map(item => {
if (item.value === sealType) {
if (item.url) {
this.form.extend.sealUrl = item.url;
} else {
this.form.extend.sealType = '1';
}
}
})
this.jumpToSeal=false
},
handleConfirmSeal() {
uni.$once('receipt-set-seal', async res => {
this.resetSeal()
});
this.jumpToSeal=true
this.$u.route({
url: 'pages/mine/shop-setting/seal',
type: 'navigateTo',
});
},
handleCancelSeal() {
let e = this.sealList[0]
this.form.extend.sealType = e.value;
this.form.extend.sealUrl = e.url;
},
repairDetail(id) { repairDetail(id) {
if (!id) return; if (!id) return;
this.loading = true; this.loading = true;
...@@ -624,7 +714,8 @@ export default { ...@@ -624,7 +714,8 @@ export default {
showSeal: data.showSeal, showSeal: data.showSeal,
// 编辑情况下,下一页的数据 // 编辑情况下,下一页的数据
expenseDetails: data.expenseDetails, expenseDetails: data.expenseDetails,
faultRecord: data.faultRecord faultRecord: data.faultRecord,
extend: data.extend
}; };
if (data.faultRecord && data.faultRecord.id) { if (data.faultRecord && data.faultRecord.id) {
this.faultRecord = { this.faultRecord = {
...@@ -878,6 +969,35 @@ export default { ...@@ -878,6 +969,35 @@ export default {
} }
} }
} }
.seal-type-view {
padding: 24rpx 0;
display: flex;
flex-wrap: wrap;
&-item {
width: 200rpx;
height: 168rpx;
background: #f6f7fa;
border-radius: 8upx;
font-size: 28upx;
color: #8d8d8d;
margin-right: 24upx;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
&:last-child {
margin-right: 0;
}
&-icon{
margin-bottom: 12rpx;
}
}
.active {
background-color: $default-color;
color: #ffffff;
}
}
.part-view { .part-view {
padding: 16rpx 24rpx 0rpx 24rpx; padding: 16rpx 24rpx 0rpx 24rpx;
......
...@@ -112,12 +112,32 @@ ...@@ -112,12 +112,32 @@
<text class="textarea-content">{{form.remark || "填写备注信息"}}</text> <text class="textarea-content">{{form.remark || "填写备注信息"}}</text>
</view> </view>
</view> </view>
<view class="part-one-line"> <!-- <view class="part-one-line">
<view class="label-view">红色水印(有效电子凭证)</view> <view class="label-view">红色水印(有效电子凭证)</view>
<view class="value-view"> <view class="value-view">
<u-switch v-model="form.showSeal" active-color="#02a074" inactive-color="#CCCCCC" <u-switch v-model="form.showSeal" active-color="#02a074" inactive-color="#CCCCCC"
@change="handleChangeShowSeal"></u-switch> @change="handleChangeShowSeal"></u-switch>
</view> </view>
</view> -->
<view class="part-one-view">
<view class="item-one-view">
<view class="label-view">是否需要客户签字</view>
<view class="value-view"><u-switch v-model="form.extend.customerSignSwitch"
active-color="#02a074" inactive-color="#CCCCCC"
@change="handleChangeShowSign"></u-switch></view>
</view>
</view>
<view class="part-view">
<view class="label-view">选择印章种类</view>
<view class="seal-type-view">
<view class="seal-type-view-item" :class="{ active: item.value == form.extend.sealType }" v-for="(item, index) in sealList" :key="index" @click="sealTypeChange(item)">
<view class="seal-type-view-item-icon" :style="{width:item.width,height:item.height}" v-if="item.url">
<image :src="item.url" mode=""></image>
</view>
<text>{{ item.label }}</text>
</view>
</view>
</view> </view>
</view> </view>
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
...@@ -132,16 +152,21 @@ ...@@ -132,16 +152,21 @@
<DateRangePicker ref="date-range" type="date" :clear-icon="false" v-model="form.extend.collectionTime"> <DateRangePicker ref="date-range" type="date" :clear-icon="false" v-model="form.extend.collectionTime">
<view style="left:200%"></view> <view style="left:200%"></view>
</DateRangePicker> </DateRangePicker>
<PopInput title="提醒" type="text" sureText="确定" content="未上传我的印章,\n是否跳转至收据设置,上传印章" :visible.sync="showSealPopup"
@cancel="handleCancelSeal" @click="handleConfirmSeal" />
</view> </view>
</template> </template>
<script> <script>
import SubmitButton from '@/components/submit-button/index.vue'; import SubmitButton from '@/components/submit-button/index.vue';
import NavbarRight from '@/components/navbar-right'; import NavbarRight from '@/components/navbar-right';
import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import PopInput from '@/components/pop-input-view';
import { sealOptions } from '@/utils/options/maintain-bill/index.js';
import { import {
repairDetail, repairDetail,
editeRepair, editeRepair,
getSealList,
getProjectMembersKnow getProjectMembersKnow
} from '@/api/maintain/index.js'; } from '@/api/maintain/index.js';
import { import {
...@@ -152,7 +177,9 @@ ...@@ -152,7 +177,9 @@
components: { components: {
NavbarRight, NavbarRight,
DateRangePicker, DateRangePicker,
SubmitButton SubmitButton,
PopInput,
CheckboxGroups
}, },
data() { data() {
return { return {
...@@ -161,6 +188,7 @@ ...@@ -161,6 +188,7 @@
chooseMemberImage: billBaseUrl + 'tiaozhuantongxunlu@3x.png', chooseMemberImage: billBaseUrl + 'tiaozhuantongxunlu@3x.png',
loading: false, loading: false,
buttonLoading: false, buttonLoading: false,
showSealPopup: false,
form: { form: {
actualAmount: '', actualAmount: '',
customerName: '', customerName: '',
...@@ -173,8 +201,16 @@ ...@@ -173,8 +201,16 @@
collectionReason: '', collectionReason: '',
collectionTime: this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd'), collectionTime: this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd'),
payType: '微信', payType: '微信',
sealType: "1",
sealUrl: "https://static-book.kaying.cc/icon/dianzishuiyin1@3x.png",
customerSignSwitch: false
} }
}, },
sealList: sealOptions, // 印章列表
checkboxCustomStyle: {
width: '200rpx',
height: '128rpx'
},
} }
}, },
computed: { computed: {
...@@ -224,7 +260,7 @@ ...@@ -224,7 +260,7 @@
if (options && options.billId) { if (options && options.billId) {
this.billId = options.billId; this.billId = options.billId;
} }
this.getSealList() // 获取印章列表
if (this.billId || this.copyId) { if (this.billId || this.copyId) {
this.repairDetail(this.billId || this.copyId); this.repairDetail(this.billId || this.copyId);
} }
...@@ -251,6 +287,53 @@ ...@@ -251,6 +287,53 @@
this.form.customerPhone = item.phone; this.form.customerPhone = item.phone;
this.showMember = false; this.showMember = false;
}, },
handleChangeShowSign() {},
async getSealList() {
try {
let res = await getSealList()
console.log(res)
res.data.map(item => {
this.sealList.map(seal=>{
if (item.value === seal.value) {
seal.url=item.url
}
})
})
} catch (e) {
console.log(e)
//TODO handle the exception
}
},
sealTypeChange(e) {
this.form.extend.sealType = e.value;
this.form.extend.sealUrl = e.url;
if (e.value === '2' && !e.url) {
this.showSealPopup = true
}
},
handleConfirmSeal() {
uni.$once('receipt-set-seal', async res => {
await this.getSealList();
this.sealList.map(item => {
if (item.value === '2') {
if (item.url) {
this.form.extend.sealUrl = item.url;
} else {
this.form.extend.sealType = '1';
}
}
})
});
this.$u.route({
url: 'pages/mine/shop-setting/seal',
type: 'navigateTo',
});
},
handleCancelSeal() {
let e = this.sealList[0]
this.form.extend.sealType = e.value;
this.form.extend.sealUrl = e.url;
},
repairDetail(id) { repairDetail(id) {
this.loading = true; this.loading = true;
repairDetail({ repairDetail({
...@@ -276,6 +359,9 @@ ...@@ -276,6 +359,9 @@
collectionReason: data.extend.collectionReason, collectionReason: data.extend.collectionReason,
collectionTime: data.extend.collectionTime, collectionTime: data.extend.collectionTime,
payType: data.extend.payType || '微信', payType: data.extend.payType || '微信',
customerSignSwitch: data.extend.customerSignSwitch,
sealType: data.extend.sealType || '1',
sealUrl: data.extend.sealUrl || '',
}, },
showSeal: data.showSeal, showSeal: data.showSeal,
receivableAmount: data.receivableAmount, receivableAmount: data.receivableAmount,
...@@ -425,6 +511,35 @@ ...@@ -425,6 +511,35 @@
height: 32rpx; height: 32rpx;
display: flex; display: flex;
} }
}
.seal-type-view {
padding: 24rpx 0;
display: flex;
flex-wrap: wrap;
&-item {
width: 200rpx;
height: 168rpx;
background: #f6f7fa;
border-radius: 8upx;
font-size: 28upx;
color: #8d8d8d;
margin-right: 24upx;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
&:last-child {
margin-right: 0;
}
&-icon{
margin-bottom: 12rpx;
}
}
.active {
background-color: $default-color;
color: #ffffff;
}
} }
.part-view { .part-view {
padding: 0rpx 24rpx; padding: 0rpx 24rpx;
...@@ -567,6 +682,43 @@ ...@@ -567,6 +682,43 @@
text-align: left; text-align: left;
} }
} }
.seal-type {
padding-top: 24rpx;
}
.part-one-view {
height: 104rpx;
background-color: #ffffff;
border-radius: 16rpx;
margin: 24rpx 0;
padding: 0 24rpx;
.item-one-view {
height: 104rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
.value-view {
display: flex;
justify-content: center;
align-items: center;
}
.label-view {
font-weight: bold;
color: #333333;
text-align: left;
}
}
}
.seal-type-view {
padding: 24rpx 0;
}
} }
} }
......
...@@ -515,7 +515,11 @@ export default { ...@@ -515,7 +515,11 @@ export default {
}, },
handleClickSign() { handleClickSign() {
if (checkToken()) { if (checkToken()) {
if (this.info.extend.customerSignSwitch) {
this.toSign()
} else {
this.repairSign(); this.repairSign();
}
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '请先登录', title: '请先登录',
...@@ -534,6 +538,17 @@ export default { ...@@ -534,6 +538,17 @@ export default {
} }
}, },
toSign() {
uni.$once("refresh-repair-detail", res => {
this.repairDetail()
})
this.$u.route({
url: 'pages/maintain-bill/signature',
params: {
billId: this.billId
}
});
},
toMainIndex() { toMainIndex() {
this.$u.route({ this.$u.route({
url: 'pages/index/index', url: 'pages/index/index',
......
<template>
<view>
<f-signature @getImg="onSignature"></f-signature>
<u-toast ref="uToast" />
</view>
</template>
<script>
import { repairSign } from '@/api/maintain/index.js';
import { UPLOAD_FILE_HOST } from '@/utils/config.js';
import upload from '@/utils/upload.js';
import { getQiNiuToken } from '@/api/upload/index.js';
export default {
data() {
return {
url:null,
fullUrl:null,
upload: {
uploading: false,
fileList: [],
qiniuToken: ''
},
};
},
onLoad(options) {
if (options && options.billId) {
this.billId = options.billId;
}
this.getQiniuToken()
},
methods:{
onSignature(e){
this.url=e;
console.log("onSignature",e)
this.uploadImage()
},
async getQiniuToken() {
try {
let { data } = await getQiNiuToken();
this.upload.qiniuToken = data;
} catch (e) {
//TODO handle the exception
}
},
async uploadImage(){
uni.showLoading({
title:"上传中",
mask:true
})
try {
let key = await upload.upload(this.url,this.upload.qiniuToken);
console.log("uploadImage",key)
let fullUrl = UPLOAD_FILE_HOST + key;
this.repairSign(fullUrl)
} catch (e) {
console.log("uploadImage",e)
uni.hideLoading()
//TODO handle the exception
}
},
async repairSign(url) {
try {
let res = await repairSign({ id: this.billId,customerSign:url });
if (res.code == 0) {
// 刷新上一级页面
uni.$emit("refresh-repair-detail")
this.$refs.uToast.show({
title: '签收成功',
type: 'success',
duration: 1500,
callback: () => {
uni.navigateBack()
}
});
}
} catch (e) {
console.log("repairSign",e)
//TODO handle the exception
}
uni.hideLoading()
},
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<view class="content-view">
<view class="rich-text" v-if="info.content">
<view class="title">
{{info.title||""}}
</view>
<!-- <rich-text space="nbsp" :nodes="info.content"></rich-text> -->
<mp-html :content="info.content" domain="https://img-code.banshouhui.com/" :tag-style="tagStyle" lazy-load
scroll-table :show-img-menu="false" @load="load" @ready="ready" @imgtap="imgtap" @linktap="linktap" />
</view>
</view>
</template>
<script>
import {
getList
} from '@/api/mine/help.js';
export default {
data() {
return {
id: null,
list: [],
info: {},
tagStyle: {
table: 'box-sizing: border-box; border-top: 1px solid #dfe2e5; border-left: 1px solid #dfe2e5;',
th: 'border-right: 1px solid #dfe2e5; border-bottom: 1px solid #dfe2e5;',
td: 'border-right: 1px solid #dfe2e5; border-bottom: 1px solid #dfe2e5;',
li: 'margin: 5px 0;'
},
};
},
onLoad(options) {
if (options && options.id) {
this.id = options.id;
this.reloadList();
}
},
methods: {
reloadList() {
this.getList();
},
async getList() {
try {
let res = await getList();
this.list = res.data || [];
this.info = res.data[0]
uni.setNavigationBarTitle({
title: this.info.title
});
console.log('getList', this.info);
} catch (e) {
//TODO handle the exception
console.log('error', e);
}
},
load() {
console.log('dom 树加载完毕')
},
ready(e) {
console.log('ready 事件触发:', e)
},
imgtap(e) {
console.log('imgtap 事件触发:', e)
},
linktap(e) {
console.log('linktap 事件触发:', e)
}
}
}
</script>
<style lang="scss" scoped>
.content-view {
padding: 24rpx;
.title{
line-height: 28rpx;
font-size: 28rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.rich-text {
background-color: #fff;
border-radius: 16rpx;
padding: 24rpx;
}
}
</style>
\ No newline at end of file
<template>
<view class="seal">
<view class="content">
<view class="title" @click="toHelp">
<text>请上传营业执照</text>
<u-icon name="question-circle" class="title-question"></u-icon>
</view>
<view class="tips">
<text>请上传图片自动识别生成公章,图片大小不超过20M</text>
</view>
<view class="seal-view">
<view class="seal-view-background">
<image :src="backgroundImage" mode="widthFix" class=""></image>
</view>
<SingleImages :max-count="count" :uploading.sync="uploading" :width="144" :height="144" :list="fileList"
@on-list-change="handlePicturesChange">
<view class="add-button" slot="addBtn">
<image :src="takePhotoIcon" mode="" class="add-button-icon"></image>
</view>
</SingleImages>
</view>
</view>
<view class="content preview" v-if="stopInfo.customSeal">
<view class="title">
<text>公章预览</text>
</view>
<view class="preview-view">
<view class="delete-view" @click.stop="onDelete" v-if="stopInfo.customSeal">
<view class="delete-icon">
<u-icon name="close" class="delete-icon-close"></u-icon>
</view>
</view>
<view class="seal-view-background">
<image :src="sealBackgroundImage" mode="widthFix" class=""></image>
</view>
<image :src="stopInfo.customSeal" mode="" class="seal-image"></image>
</view>
</view>
<submit-button background="#f6f7fa" :loading="loading"
text="确认" @handleClick="submit"></submit-button>
<PopInput title="免责声明" type="text" sureText="确定" :visible.sync="showSealPopup" @click="handleConfirmSeal">
<view class="disclaimer" slot="content">
<view class="disclaimer-text">
1、用户自行上传自定义公章进行开具收据时,应确保其为合法、有效的公章,并自行承担因公章使用不当或违反法律法规造成的一切法律后果。
</view>
<view class="disclaimer-text">
2、我们不对用户上传的自定义公章的真实性、合法性及有效性进行任何形式的审查,仅提供收据开具服务,不承担因公章使用不当所产生的一切法律后果。
</view>
<view class="disclaimer-text">
3、用户上传的自定义公章信息,仅用于在本软件上开具相关收据,并不泄露给任何其他第三方机构或个人。
</view>
<view class="disclaimer-text">
4、若因用户上传虚假或非法公章信息造成的损失,由用户自行承担,与本司无关,同时,我们将配合相关部门对恶意使用公章的用户进行监管和处理。
</view>
<view class="disclaimer-text">
5、最终解释权归本司所有。
</view>
<view class="disclaimer-text">
请用户在使用本软件前,仔细阅读以上免责声明,并自行承担因使用不当或违反法律法规而导致的一切风险和责任。如有疑问,请咨询专业律师或相关部门。
</view>
</view>
</PopInput>
</view>
</template>
<script>
import SubmitButton from '@/components/submit-button/index.vue';
import SingleImages from '@/components/upload/single.vue';
import PopInput from '@/components/pop-input-view/index.vue';
import {
receiptIndexBaseUrl,
indexBaseUrl
} from '@/utils/config.js';
import {
madeSeal
} from '@/api/maintain/index.js';
import {
getShopInfo,
updateShopInfo
} from "@/api/mine/shop.js"
export default {
components: {
SubmitButton,
SingleImages,
PopInput
},
data() {
return {
backgroundImage:receiptIndexBaseUrl+"shangchuanbeijing-1@3x.png",
sealBackgroundImage:receiptIndexBaseUrl+"yinzhangdibeijing@3x.png",
takePhotoIcon: receiptIndexBaseUrl + 'dianjishangchuan-1@3x.png',
loading: false,
uploading: false,
showSealPopup: false,
stopInfo: {
customSeal: ''
},
imageUrl: '',
count: 1,
fileList: [],
readOnly:false,
};
},
computed: {
canConfirm() {
return this.stopInfo.customSeal ? true : false;
}
},
onLoad() {
this.getShop()
},
onUnload() {
uni.$off('receipt-set-shop-seal');
uni.$off('receipt-set-seal');
},
methods: {
async getShop() {
try {
let res = await getShopInfo()
this.stopInfo = res.data
} catch (e) {
//TODO handle the exception
console.log(e)
}
},
async updateShop() {
this.loading = true
let params = {
id: this.stopInfo.id,
customSeal: this.stopInfo.customSeal
}
try {
let res = await updateShopInfo(params)
this.stopInfo = res.data
uni.$emit("receipt-set-seal")
uni.$emit('receipt-set-shop-seal')
uni.navigateBack()
} catch (e) {
//TODO handle the exception
console.log(e)
}
this.loading = false;
},
submit() {
if (!this.stopInfo.customSeal) {
this.updateShop()
}else{
this.showSealPopup = true
}
},
handleConfirmSeal() {
this.updateShop()
},
handlePicturesChange(lists) {
uni.showLoading({
title: "上传中",
mask: true
})
if (lists && lists.length) {
console.log(lists);
let url = lists[0];
this.imageUrl = url;
this.madeSeal()
}
this.fileList = [];
},
async madeSeal() {
uni.showLoading({
title: "识别中",
mask: true
})
try {
let res = await madeSeal({
url: this.imageUrl
})
if (res.code === 0 && res.data) {
this.stopInfo.customSeal = res.data
} else {
this.showToast(res.msg)
}
} catch (e) {
console.log(e)
//TODO handle the exception
}
uni.hideLoading()
},
onDelete(){
this.showToast("删除")
this.stopInfo.customSeal=""
},
// 跳转帮助页
toHelp(){
this.$u.route({
url: 'pages/mine/help/help-detail?id=100',
type: 'navigateTo',
});
}
}
}
</script>
<style lang="scss" scoped>
.seal {
padding: 24rpx;
.content{
padding: 32rpx 24rpx;
background: #FFFFFF;
border-radius: 16rpx;
}
.preview{
margin-top: 24rpx;
}
.title {
font-size: 28rpx;
margin-bottom: 24rpx;
.title-question {
margin-left: 12rpx;
font-size: 30rpx;
}
}
.tips {
font-size: 24rpx;
color: #8d8d8d;
margin-bottom: 32rpx;
}
.seal-view {
position: relative;
width: 100%;
height: 368rpx;
background-color: #d2d6d6;
overflow: hidden;
border-radius: 16rpx;
.seal-view-background{
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
}
.add-button {
position: relative;
z-index: 10;
width: 654rpx;
height: 368rpx;
border-radius: 20rpx;
// border: 2rpx dashed #cccccc;
// background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
.add-button-icon {
width: 92rpx;
height: 92rpx;
}
}
}
.seal-view-background{
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
overflow: hidden;
border-radius: 16rpx;
}
.preview-view{
width: 100%;
height: 268rpx;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.seal-image {
position: relative;
z-index: 10;
width: 240rpx;
height: 240rpx;
}
.delete-view{
width: 80rpx;
height: 80rpx;
position: absolute;
top: 0rpx;
right: 0rpx;
z-index: 99;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.delete-icon {
background-color: #8d8d8d;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
text-align: center;
line-height: 40rpx;
}
.delete-icon-close {
color: #ffffff;
font-size: 24rpx;
}
.disclaimer {
margin-top: -30rpx;
font-size: 24rpx;
.disclaimer-text {
text-align: left;
font-size: 24rpx;
line-height: 34rpx;
margin-bottom: 12rpx;
}
}
}
</style>
\ No newline at end of file
...@@ -7,7 +7,18 @@ ...@@ -7,7 +7,18 @@
<u-switch slot="right-icon" v-model="stopInfo.intoBookRecord" active-color="#02A074" inactive-color="#8D8D8D" :loading="switchLoading" @change="switchChange"></u-switch> <u-switch slot="right-icon" v-model="stopInfo.intoBookRecord" active-color="#02A074" inactive-color="#8D8D8D" :loading="switchLoading" @change="switchChange"></u-switch>
</view> </view>
</view> </view>
<view class="padding">
<view class="switch">
<view class="label">我的印章</view>
<view class="seal-view" @click="setSeal">
<view class="seal-image" v-if="stopInfo.customSeal">
<image :src="stopInfo.customSeal" ></image>
</view>
<view v-else>上传印章</view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
</view> </view>
</template> </template>
...@@ -24,7 +35,8 @@ export default { ...@@ -24,7 +35,8 @@ export default {
name: '', name: '',
address: '', address: '',
phone: '', phone: '',
intoBookRecord:false intoBookRecord:false,
customSeal:"", // 印章URL
}, },
switchLoading: false switchLoading: false
}; };
...@@ -60,6 +72,15 @@ export default { ...@@ -60,6 +72,15 @@ export default {
console.log(e) console.log(e)
} }
this.switchLoading = false; this.switchLoading = false;
},
setSeal(){
uni.$once('receipt-set-shop-seal', res => {
this.getShop()
});
this.$u.route({
url: 'pages/mine/shop-setting/seal',
type: 'navigateTo',
});
} }
} }
}; };
...@@ -75,9 +96,9 @@ export default { ...@@ -75,9 +96,9 @@ export default {
margin-top: 24upx; margin-top: 24upx;
background: #ffffff; background: #ffffff;
border-radius: 16upx; border-radius: 16upx;
padding: 0 24upx; padding: 24upx;
width: 100%; width: 100%;
height: 104upx; // height: 104upx;
background: #ffffff; background: #ffffff;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -86,6 +107,24 @@ export default { ...@@ -86,6 +107,24 @@ export default {
font-weight: bold; font-weight: bold;
font-size: 28upx; font-size: 28upx;
} }
.seal-view{
display: flex;
align-items: center;
justify-content: flex-end;
}
.seal-image{
width: 120rpx;
height: 120rpx;
margin-right: 24rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.background{
background-color: #8d8d8d;
}
} }
} }
</style> </style>
## canvas手写板,超漂亮的横屏签名
下载下来后,将组件中f-signature.vue复制到您的组件中
### 使用方法
引用组件--注意您组件的路径
```
import fSignature from '@/components/module/f-signature/f-signature';
```
案例
```
<f-signature></f-signature>
```
### 欢迎加入wx群聊,一起交流技术
| `微信交流群(加我好友备注"进群")` |
|--------------------------- |
|![微信交流群](https://img02.163.gg/img/1/19/33/61/1193361-dtzzkprpse.jpg!YM0000)|
|微信号:wbt10302015|
<template>
<!-- 签名横屏 -->
<view class="signa">
<view class="box">
<canvas class="canvas" disable-scroll="true" :style="{'width':width,'height':height}" canvas-id="designature" @touchstart="starts"
@touchmove="moves" @touchend="end"></canvas>
<view class="bottomBox u-flex">
<view class="tip">请你在此手动签写自己的签章,签写操作完毕点击保存按钮</view>
<view class="btn" style="margin-top: 18vw;" @click="cancel">取消</view>
<view class="btn" style="margin-top: 8vw;" @click="clear">清除</view>
<view class="btn blue" @click="save">保存</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
resultUrl: '',
dom: null,
line: [],
width: '0px',
height: '0px',
radius: 0
}
},
created() {
uni.getSystemInfo({
success: (res) => {
this.width = res.windowWidth - 56 + 'px';
this.height = res.windowHeight - 154 + 'px';
}
});
this.dom = uni.createCanvasContext('designature',this);
},
methods: {
cancel(){
uni.navigateBack()
},
end(e) {
},
distance(a, b) {
let x = b.x - a.x;
let y = b.y - a.y;
return Math.sqrt(x * x + y * y);
},
starts(e) {
console.log(e)
this.line.push({
points: [{
time: new Date().getTime(),
x: e.touches[0].x,
y: e.touches[0].y,
dis: 0
}]
})
let currentPoint = {
x: e.touches[0].x,
y: e.touches[0].y
}
this.currentPoint = currentPoint
this.drawer(this.line[this.line.length - 1])
},
moves(e) {
console.log(e)
let point = {
x: e.touches[0].x,
y: e.touches[0].y
}
this.lastPoint = this.currentPoint,
this.currentPoint = point
this.line[this.line.length - 1].points.push({
time: new Date().getTime(),
x: e.touches[0].x,
y: e.touches[0].y,
dis: this.distance(this.currentPoint, this.lastPoint)
})
this.drawer(this.line[this.line.length - 1])
},
drawer(item) {
let x1, x2, y1, y2, len, radius, r, cx, cy, t = 0.5,
x, y;
var time = 0;
if (item.points.length > 2) {
let lines = item.points[item.points.length - 3];
let line = item.points[item.points.length - 2];
let end = item.points[item.points.length - 1];
x = line.x;
y = line.y;
x1 = lines.x;
y1 = lines.y;
x2 = end.x;
y2 = end.y;
var dis = 0;
time = (line.time - lines.time) + (end.time - line.time)
dis = line.dis + lines.dis + end.dis;
var dom = this.dom;
var or = Math.min(time / dis * this.linePressure + this.lineMin, this.lineMax);
cx = (x - (Math.pow(1 - t, 2) * x1) - Math.pow(t, 2) * x2) / (2 * t * (1 - t))
cy = (y - (Math.pow(1 - t, 2) * y1) - Math.pow(t, 2) * y2) / (2 * t * (1 - t))
dom.setLineCap('round')
dom.beginPath();
dom.setStrokeStyle('black')
dom.setLineWidth(5)
dom.moveTo(x1, y1);
dom.quadraticCurveTo(cx, cy, x2, y2);
dom.stroke();
dom.draw(true)
}
},
clear() {
this.dom.clearRect(0, 0, 1000, 1000)
this.dom.draw()
},
save() {
var t=this;
console.log(555)
uni.canvasToTempFilePath({
canvasId: 'designature',
fileType: 'png',
quality: 1, //图片质量
success:function(res) {
console.log(res.tempFilePath)
t.$emit('getImg',res.tempFilePath)
},
fail(e){
console.log(e)
}
},this)
}
}
}
</script>
<style scoped lang="scss">
.signa {
position: relative;
overflow: hidden;
background-color: #fff;
height: 100vh;
width: 100vw;
padding: 20px 16px 30px;
.box{
background-color: #fff;
border-radius: 20rpx;
padding: 12px 12px 100px;
box-shadow: 0 6rpx 42rpx rgba(0, 0, 0, 0.05);
}
.canvas {
background-color: #E6E6E6;
position: relative;
z-index: 9999;
}
.bottomBox{
flex-direction: column;
justify-content: center;
width: 100px;
height: 80vw;
padding: 10px;
// background-color: #007AFF;
position: fixed;
left: 50%;
bottom: -40vw;
transform: rotate(90deg);
margin-left: -50px;
margin-bottom: 72px;
.tip{
font-size: 11px;
color: #FF6F77;
}
.btn{
width: 100%;
height: 37px;
background: #F5F5F5;
border-radius: 19px;
margin-top: 7px;
text-align: center;
line-height: 37px;
color: #333333;
font-size: 13px;
&.blue{
background: #284CF4;
color: #fff;
}
}
}
}
</style>
{
"id": "f-signature",
"displayName": "canvas手写板,横屏签名",
"version": "1.0.0",
"description": "超漂亮的横屏签名,支持多平台",
"keywords": [
"canvas",
"签名",
"autograph"
],
"dcloudext": {
"category": [
"前端组件",
"通用组件"
]
}
}
\ No newline at end of file
## 为减小组件包的大小,默认组件包中不包含编辑、latex 公式等扩展功能,需要使用扩展功能的请参考下方的 插件扩展 栏的说明
## 功能介绍
- 全端支持(含 `v3、NVUE`)
- 支持丰富的标签(包括 `table`、`video`、`svg` 等)
- 支持丰富的事件效果(自动预览图片、链接处理等)
- 支持设置占位图(加载中、出错时、预览时)
- 支持锚点跳转、长按复制等丰富功能
- 支持大部分 *html* 实体
- 丰富的插件(关键词搜索、内容编辑、`latex` 公式等)
- 效率高、容错性强且轻量化
查看 [功能介绍](https://jin-yufeng.gitee.io/mp-html/#/overview/feature) 了解更多
## 使用方法
- `uni_modules` 方式
1. 点击右上角的 `使用 HBuilder X 导入插件` 按钮直接导入项目或点击 `下载插件 ZIP` 按钮下载插件包并解压到项目的 `uni_modules/mp-html` 目录下
2. 在需要使用页面的 `(n)vue` 文件中添加
```html
<!-- 不需要引入,可直接使用 -->
<mp-html :content="html" />
```
```javascript
export default {
data() {
return {
html: '<div>Hello World!</div>'
}
}
}
```
3. 需要更新版本时在 `HBuilder X` 中右键 `uni_modules/mp-html` 目录选择 `从插件市场更新` 即可
- 源码方式
1. 从 [github](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 或 [gitee](https://gitee.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 下载源码
插件市场的 **非 uni_modules 版本** 无法更新,不建议从插件市场获取
2. 在需要使用页面的 `(n)vue` 文件中添加
```html
<mp-html :content="html" />
```
```javascript
import mpHtml from '@/components/mp-html/mp-html'
export default {
// HBuilderX 2.5.5+ 可以通过 easycom 自动引入
components: {
mpHtml
},
data() {
return {
html: '<div>Hello World!</div>'
}
}
}
```
- npm 方式
1. 在项目根目录下执行
```bash
npm install mp-html
```
2. 在需要使用页面的 `(n)vue` 文件中添加
```html
<mp-html :content="html" />
```
```javascript
import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
export default {
// 不可省略
components: {
mpHtml
},
data() {
return {
html: '<div>Hello World!</div>'
}
}
}
```
3. 需要更新版本时执行以下命令即可
```bash
npm update mp-html
```
使用 *cli* 方式运行的项目,通过 *npm* 方式引入时,需要在 *vue.config.js* 中配置 *transpileDependencies*,详情可见 [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687)
如果在 **nvue** 中使用还要将 `dist/uni-app/static` 目录下的内容拷贝到项目的 `static` 目录下,否则无法运行
查看 [快速开始](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart) 了解更多
## 组件属性
| 属性 | 类型 | 默认值 | 说明 |
|:---:|:---:|:---:|---|
| container-style | String | | 容器的样式([2.1.0+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v210)) |
| content | String | | 用于渲染的 html 字符串 |
| copy-link | Boolean | true | 是否允许外部链接被点击时自动复制 |
| domain | String | | 主域名(用于链接拼接) |
| error-img | String | | 图片出错时的占位图链接 |
| lazy-load | Boolean | false | 是否开启图片懒加载 |
| loading-img | String | | 图片加载过程中的占位图链接 |
| pause-video | Boolean | true | 是否在播放一个视频时自动暂停其他视频 |
| preview-img | Boolean | true | 是否允许图片被点击时自动预览 |
| scroll-table | Boolean | false | 是否给每个表格添加一个滚动层使其能单独横向滚动 |
| selectable | Boolean | false | 是否开启文本长按复制 |
| set-title | Boolean | true | 是否将 title 标签的内容设置到页面标题 |
| show-img-menu | Boolean | true | 是否允许图片被长按时显示菜单 |
| tag-style | Object | | 设置标签的默认样式 |
| use-anchor | Boolean | false | 是否使用锚点链接 |
查看 [属性](https://jin-yufeng.gitee.io/mp-html/#/basic/prop) 了解更多
## 组件事件
| 名称 | 触发时机 |
|:---:|---|
| load | dom 树加载完毕时 |
| ready | 图片加载完毕时 |
| error | 发生渲染错误时 |
| imgtap | 图片被点击时 |
| linktap | 链接被点击时 |
| play | 音视频播放时 |
查看 [事件](https://jin-yufeng.gitee.io/mp-html/#/basic/event) 了解更多
## api
组件实例上提供了一些 `api` 方法可供调用
| 名称 | 作用 |
|:---:|---|
| in | 将锚点跳转的范围限定在一个 scroll-view 内 |
| navigateTo | 锚点跳转 |
| getText | 获取文本内容 |
| getRect | 获取富文本内容的位置和大小 |
| setContent | 设置富文本内容 |
| imgList | 获取所有图片的数组 |
| pauseMedia | 暂停播放音视频([2.2.2+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v222)) |
| setPlaybackRate | 设置音视频播放速率([2.4.0+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v240)) |
查看 [api](https://jin-yufeng.gitee.io/mp-html/#/advanced/api) 了解更多
## 插件扩展
除基本功能外,本组件还提供了丰富的扩展,可按照需要选用
| 名称 | 作用 |
|:---:|---|
| audio | 音乐播放器 |
| editable | 富文本 **编辑**([示例项目](https://mp-html.oss-cn-hangzhou.aliyuncs.com/editable.zip)) |
| emoji | 解析 emoji |
| highlight | 代码块高亮显示 |
| markdown | 渲染 markdown |
| search | 关键词搜索 |
| style | 匹配 style 标签中的样式 |
| txv-video | 使用腾讯视频 |
| img-cache | 图片缓存 by [@PentaTea](https://github.com/PentaTea) |
| latex | 渲染 latex 公式 by [@Zeng-J](https://github.com/Zeng-J) |
从插件市场导入的包中 **不含有** 扩展插件,使用插件需通过微信小程序 `富文本插件` 获取或参考以下方法进行打包:
1. 获取完整组件包
```bash
npm install mp-html
```
2. 编辑 `tools/config.js` 中的 `plugins` 项,选择需要的插件
3. 生成新的组件包
在 `node_modules/mp-html` 目录下执行
```bash
npm install
npm run build:uni-app
```
4. 拷贝 `dist/uni-app` 中的内容到项目根目录
查看 [插件](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin) 了解更多
## 关于 nvue
`nvue` 使用原生渲染,不支持部分 `css` 样式,为实现和 `html` 相同的效果,组件内部通过 `web-view` 进行渲染,性能上差于原生,根据 `weex` 官方建议,`web` 标签仅应用在非常规的降级场景。因此,如果通过原生的方式(如 `richtext`)能够满足需要,则不建议使用本组件,如果有较多的富文本内容,则可以直接使用 `vue` 页面
由于渲染方式与其他端不同,有以下限制:
1. 不支持 `lazy-load` 属性
2. 视频不支持全屏播放
3. 如果在 `flex-direction: row` 的容器中使用,需要给组件设置宽度或设置 `flex: 1` 占满剩余宽度
纯 `nvue` 模式下,[此问题](https://ask.dcloud.net.cn/question/119678) 修复前,不支持通过 `uni_modules` 引入,需要本地引入(将 [dist/uni-app](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 中的内容拷贝到项目根目录下)
## 立即体验
![富文本插件](https://mp-html.oss-cn-hangzhou.aliyuncs.com/qrcode.jpg)
## 问题反馈
遇到问题时,请先查阅 [常见问题](https://jin-yufeng.gitee.io/mp-html/#/question/faq) 和 [issue](https://github.com/jin-yufeng/mp-html/issues) 中是否已有相同的问题
可通过 [issue](https://github.com/jin-yufeng/mp-html/issues/new/choose) 、插件问答或发送邮件到 [mp_html@126.com](mailto:mp_html@126.com) 提问,不建议在评论区提问(不方便回复)
提问请严格按照 [issue 模板](https://github.com/jin-yufeng/mp-html/issues/new/choose) ,描述清楚使用环境、`html` 内容或可复现的 `demo` 项目以及复现方式,对于 **描述不清**、**无法复现** 或重复的问题将不予回复
欢迎加入 `QQ` 交流群:
群1(已满):`699734691`
群2:`778239129`
查看 [问题反馈](https://jin-yufeng.gitee.io/mp-html/#/question/feedback) 了解更多
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"id": "mp-html",
"displayName": "mp-html 富文本组件【全端支持,支持编辑、latex等扩展】",
"version": "v2.4.2",
"description": "一个强大的富文本组件,高效轻量,功能丰富",
"keywords": [
"富文本",
"编辑器",
"html",
"rich-text",
"editor"
],
"repository": "https://github.com/jin-yufeng/mp-html",
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/mp-html",
"type": "component-vue"
},
"uni_modules": {
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "u",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}
\ No newline at end of file
"use strict";function t(t){for(var e=Object.create(null),n=t.attributes.length;n--;)e[t.attributes[n].name]=t.attributes[n].value;return e}function e(){a[1]&&(this.src=a[1],this.onerror=null),this.onclick=null,this.ontouchstart=null,uni.postMessage({data:{action:"onError",source:"img",attrs:t(this)}})}function n(){window.unloadimgs-=1,0===window.unloadimgs&&uni.postMessage({data:{action:"onReady"}})}function o(r,s,c){for(var d=0;d<r.length;d++)!function(d){var u=r[d],l=void 0;if(u.type&&"node"!==u.type)l=document.createTextNode(u.text.replace(/&amp;/g,"&"));else{var g=u.name;"svg"===g&&(c="http://www.w3.org/2000/svg"),"html"!==g&&"body"!==g||(g="div"),l=c?document.createElementNS(c,g):document.createElement(g);for(var p in u.attrs)l.setAttribute(p,u.attrs[p]);if(u.children&&o(u.children,l,c),"img"===g){if(window.unloadimgs+=1,l.onload=n,l.onerror=n,!l.src&&l.getAttribute("data-src")&&(l.src=l.getAttribute("data-src")),u.attrs.ignore||(l.onclick=function(e){e.stopPropagation(),uni.postMessage({data:{action:"onImgTap",attrs:t(this)}})}),a[2]){var h=new Image;h.src=l.src,l.src=a[2],h.onload=function(){l.src=this.src},h.onerror=function(){l.onerror()}}l.onerror=e}else if("a"===g)l.addEventListener("click",function(e){e.stopPropagation(),e.preventDefault();var n,o=this.getAttribute("href");o&&"#"===o[0]&&(n=(document.getElementById(o.substr(1))||{}).offsetTop),uni.postMessage({data:{action:"onLinkTap",attrs:t(this),offset:n}})},!0);else if("video"===g||"audio"===g)i.push(l),u.attrs.autoplay||u.attrs.controls||l.setAttribute("controls","true"),l.onplay=function(){if(uni.postMessage({data:{action:"onPlay"}}),a[3])for(var t=0;t<i.length;t++)i[t]!==this&&i[t].pause()},l.onerror=function(){uni.postMessage({data:{action:"onError",source:g,attrs:t(this)}})};else if("table"===g&&a[4]&&!l.style.cssText.includes("inline")){var f=document.createElement("div");f.style.overflow="auto",f.appendChild(l),l=f}else"svg"===g&&(c=void 0)}s.appendChild(l)}(d)}document.addEventListener("UniAppJSBridgeReady",function(){document.body.onclick=function(){return uni.postMessage({data:{action:"onClick"}})},uni.postMessage({data:{action:"onJSBridgeReady"}})});var a,i=[];window.setContent=function(t,e,n){var r=document.getElementById("content");e[0]&&(document.body.style.cssText=e[0]),e[5]||(r.style.userSelect="none"),n||(r.innerHTML="",i=[]),a=e,window.unloadimgs=0;var s=document.createDocumentFragment();o(t,s),r.appendChild(s);var c=r.scrollHeight;uni.postMessage({data:{action:"onLoad",height:c}}),window.unloadimgs||uni.postMessage({data:{action:"onReady",height:c}}),clearInterval(window.timer),window.timer=setInterval(function(){r.scrollHeight!==c&&(c=r.scrollHeight,uni.postMessage({data:{action:"onHeightChange",height:c}}))},350)},window.onunload=function(){clearInterval(window.timer)};
\ No newline at end of file
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function t(e,t){return n.call(e,t)}var i=[],a=function(e,n){var t={options:{timestamp:+new Date},name:e,arg:n};if(window.__dcloud_weex_postMessage||window.__dcloud_weex_){if("postMessage"===e){var a={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(a):window.__dcloud_weex_.postMessage(JSON.stringify(a))}var o={type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(o):window.__dcloud_weex_.postMessageToService(JSON.stringify(o))}if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:t,pageId:""},"*");if(0===i.length){var r=plus.webview.currentWebview();if(!r)throw new Error("plus.webview.currentWebview() is undefined");var d=r.parent(),s="";s=d?d.id:r.id,i.push(s)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}},"__uniapp__service");else{var w=JSON.stringify(t);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(w,",").concat(JSON.stringify(i),");"))}},o={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;a("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("redirectTo",{url:encodeURI(n)})},getEnv:function(e){window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a("postMessage",e.data||{})}},r=/uni-app/i.test(navigator.userAgent),d=/Html5Plus/i.test(navigator.userAgent),s=/complete|loaded|interactive/;var w=window.my&&navigator.userAgent.indexOf("AlipayClient")>-1;var u=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var g=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var v=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.qa&&/quickapp/i.test(navigator.userAgent);for(var l,_=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},f=[function(e){if(r||d)return window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&s.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),o},function(e){if(v)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(w){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(u)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(g)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(p){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){return document.addEventListener("DOMContentLoaded",e),o}],m=0;m<f.length&&!(l=f[m](_));m++);l||(l={});var E="undefined"!=typeof uni?uni:{};if(!E.navigateTo)for(var b in l)t(l,b)&&(E[b]=l[b]);return E.webView=l,E}));
\ No newline at end of file
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><style>body,html{width:100%;height:100%;overflow-x:scroll;overflow-y:hidden}body{margin:0}video{width:300px;height:225px}img{max-width:100%;-webkit-touch-callout:none}</style></head><body><div id="content" style="overflow:hidden"></div><script type="text/javascript" src="./js/uni.webview.min.js"></script><script type="text/javascript" src="./js/handler.js"></script></body>
\ No newline at end of file
...@@ -16,6 +16,7 @@ export const mineBaseUrl = process.uniEnv.qn_base_url + 'mine/'; // 七牛云对 ...@@ -16,6 +16,7 @@ export const mineBaseUrl = process.uniEnv.qn_base_url + 'mine/'; // 七牛云对
export const billBaseUrl = process.uniEnv.qn_base_url + 'bill/'; // 七牛云对象存储图片地址-账单 export const billBaseUrl = process.uniEnv.qn_base_url + 'bill/'; // 七牛云对象存储图片地址-账单
export const planBaseUrl = process.uniEnv.qn_base_url + 'plan/'; // 七牛云对象存储图片地址-行程 export const planBaseUrl = process.uniEnv.qn_base_url + 'plan/'; // 七牛云对象存储图片地址-行程
export const UPLOAD_FILE_HOST = process.uniEnv.qn_asset_url; // 服务器用户上传文件地址 export const UPLOAD_FILE_HOST = process.uniEnv.qn_asset_url; // 服务器用户上传文件地址
export const receiptIndexBaseUrl = process.uniEnv.qn_asset_url + 'receipt/index/'; // 七牛云对象存储图片地址-首页
export const wxMiniId = 'gh_7add974cc08f' export const wxMiniId = 'gh_7add974cc08f'
export const webUrl = 'http://kaying.cc/banshoujizhangjieshao/index.html' export const webUrl = 'http://kaying.cc/banshoujizhangjieshao/index.html'
......
...@@ -265,3 +265,25 @@ export const chooseMemberTabs = [{ ...@@ -265,3 +265,25 @@ export const chooseMemberTabs = [{
name: 'collection' name: 'collection'
}, },
] ]
export const sealOptions = [{
value: "1",
label: "电子水印",
url: "",
width:"134rpx",
height:"70rpx",
},
{
value: "2",
label: "公章",
url: "",
width:"70rpx",
height:"70rpx",
},
{
value: "3",
label: "无",
url: "",
},
]
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