first commit

This commit is contained in:
zhaoxinyu
2024-04-10 15:19:47 +08:00
commit f857065a3a
2884 changed files with 683559 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,19 @@
const welfareMixins = {
data() {
return {
tarBarActive: '',
addressList: [],
isReceive: false
}
},
methods: {
async selectAddressList() {
const resp = await $.get('/mobile/welfare/mine/selectUserAddress')
this.addressList = resp.data
},
async getReceive() {
const resp = await $.get('/mobile/welfare/mine/isReceive', {projectId: this.projectId})
this.isReceive = resp.data
}
}
}
@@ -0,0 +1,4 @@
<van-tabbar v-model="tarBarActive">
<van-tabbar-item icon="home-o" url="/mobile/welfare/list/index">首页</van-tabbar-item>
<van-tabbar-item icon="manager-o" url="/mobile/welfare/mine/index">我的</van-tabbar-item>
</van-tabbar>
@@ -0,0 +1,23 @@
<!--#
layout("/mobile/platform.html"){
#-->
<div id="app" v-cloak>
<van-cell-group inset>
<van-cell title="单元格" value="内容"></van-cell>
<van-cell title="单元格" value="内容" label="描述信息"></van-cell>
</van-cell-group>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {}
}
})
</script>
<!--#
}
#-->
File diff suppressed because one or more lines are too long
@@ -0,0 +1,57 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
#app {
background: #ffffff;
}
.desc {
padding: 10px;
word-wrap: break-word;
word-break: normal;
}
@media (max-width: 750px) {
img {
background-size: contain;
width: 90%;
height: auto;
margin: 0 auto;
display: block;
}
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar @click-left="history.back()" left-arrow
title="详情"></van-nav-bar>
</van-sticky>
<div class="desc" v-html="desc"></div>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {
desc: null
}
},
methods: {},
created() {
const id = GetQueryString("optionId")
if (id) {
this.desc = window.localStorage.getItem('welfare_option_desc_' + id)
}
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,514 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.van-cell-group--inset {
margin: 10px 16px !important;
overflow: hidden;
border-radius: 8px;
}
.selection:not(:last-child) {
border-bottom: 1px dashed lightgrey;
}
.selection .van-checkbox-group .van-cell, .selection .van-radio-group .van-cell {
flex-direction: row-reverse;
}
.selection .van-checkbox-group .van-cell .van-cell__title, .selection .van-radio-group .van-cell .van-cell__title {
padding-left: 20px;
}
.address-cell .van-cell__title {
flex: unset;
width: 70px;
overflow: hidden;
}
.address-cell .van-cell__value {
text-align: left;
display: flex;
align-items: baseline;
}
.van-empty {
position: absolute;
}
.van-collapse-item .van-collapse-item__title {
}
.selection .van-radio {
display: flex;
align-items: baseline;
}
.selection .van-cell__label {
display: flex;
height: 80px;
max-height: 80px;
}
.selection .van-cell__label .welfare_img {
width: 100px;
height: 80px;
}
.selection .van-cell__label .welfare_desc {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
width: calc(100% - 100px);
padding: 0 10px;
line-height: 20px;
max-height: 80px;
position: relative;
}
.selection .van-cell__label .welfare_desc .more {
/*content:"更多";*/
position: absolute;
bottom: 0;
right: 10px;
color: #1867b0;
}
#signature {
height: 50vh;
background: #fff;
border: 1px dashed grey;
position: relative;
}
#signature .signature_reset {
position: absolute;
bottom: 2px;
right: 2px;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="福利详情" left-arrow
@click-left="history.back()"></van-nav-bar>
</van-sticky>
<template v-show="vLoading && !vLoading.value">
<!--基本信息-->
<van-collapse class="van-cell-group--inset" v-model="activeNames">
<van-collapse-item name="1">
<template #title>
<div style="font-weight: bold;font-size: 15px;display: flex;align-items: center">
<van-icon class="van-cell__left-icon" color="red" name="star"></van-icon>
福利信息
</div>
</template>
<van-cell-group class="--van-cell-group--inset">
<!-- <van-cell>-->
<!-- <template #icon>-->
<!-- <van-icon class="van-cell__left-icon" name="star" color="red"></van-icon>-->
<!-- </template>-->
<!-- <template #title>-->
<!-- <div style="font-weight: bold;font-size: 15px">福利信息</div>-->
<!-- </template>-->
<!-- </van-cell>-->
<van-cell :border="false" :value="projectInfo.name" title="福利名称"></van-cell>
<van-cell :border="false" :value="projectInfo.festival" title="发放节日"></van-cell>
<van-cell :border="false" :value="projectInfo.gift" title="福利礼品"
v-if="!projectInfo.flexible"></van-cell>
<van-cell :border="false" :value="projectInfo.provideAddress" title="发放地点"></van-cell>
<van-cell :border="false" title="发放形式">
<template>
{{welfareProvideMode.find(v=>v.code==projectInfo.provideMode) &&
welfareProvideMode.find(v=>v.code==projectInfo.provideMode).description}}
</template>
</van-cell>
<van-cell :border="false" title="签收形式">
<template>
{{welfareSignMode.find(v=>v.code==projectInfo.signMode) &&
welfareSignMode.find(v=>v.code==projectInfo.signMode).description}}
</template>
</van-cell>
<van-cell :border="false" title="发放时间">
<template #label>
{{projectInfo.provideTimeStart + ' 至 ' + projectInfo.provideTimeEnd}}
</template>
</van-cell>
</van-cell-group>
</van-collapse-item>
</van-collapse>
<!--礼品套餐-->
<div v-if="projectInfo.flexible && [2,3,4].includes(projectInfo.provideMode) && projectInfo.welfareProjectSubjects && projectInfo.welfareProjectSubjects.length>0"
class="van-cell-group--inset"
style="margin:10px auto">
<van-cell>
<template #icon>
<van-icon class="van-cell__left-icon" name="fire" color="red"></van-icon>
</template>
<template #title>
<div style="font-weight: bold;font-size: 15px">选择福利</div>
</template>
</van-cell>
<div v-for="(subject,sidx) in projectInfo.welfareProjectSubjects" class="selection">
<van-cell :border="false">
<!-- <span>({{sidx+1}}).</span>-->
{{subject.subjectName}}
</van-cell>
<van-radio-group v-model="subject.selection" v-if="subject.subjectType==='radio'">
<van-cell v-for="(option, oidx) in subject.options"
:border="false"
clickable
@click="subject.selection = option.id"
:key="option.id"
:title="option.optionName">
<template #label>
<div class="welfare_img" v-if="option.imgUrl">
<!-- @click.stop="vant.ImagePreview({images:[FILE_DOMAIN+option.imgUrl],overlayStyle:{background:'rgba(0,0,0,.9)'}})"-->
<van-image
:src="FILE_STREAM_PREVIEW_ADDRESS+'?id='+option.imgUrl"
height="80"
width="100"
></van-image>
<!-- 查看图片-->
</div>
<div class="welfare_desc" v-if="option.description">
{{removeHTMLTag(option.description).substr(0,40)+'...'}}
<a @click.stop="viewDesc(option.id,option.description)" class="more" href="#"
v-if="removeHTMLTag(option.description).length>40">查看更多</a>
</div>
</template>
<template #right-icon>
<van-radio :name="option.id"></van-radio>
</template>
</van-cell>
</van-radio-group>
<van-checkbox-group v-model="subject.selection" v-if="subject.subjectType==='checkBox'">
<van-cell
v-for="(option, oidx) in subject.options"
:border="false"
clickable
@click="checkBoxToggle('checkboxes-'+option.id)"
:key="option.id"
:title="option.optionName"
>
<template #label>
<span v-if="option.imgUrl"
@click.stop="vant.ImagePreview({images:[FILE_DOMAIN+option.imgUrl],overlayStyle:{background:'rgba(0,0,0,.9)'}})">查看图片</span>
</template>
<template #right-icon>
<van-checkbox :name="option.id" shape="square"
:ref="'checkboxes-'+option.id"></van-checkbox>
</template>
</van-cell>
</van-checkbox-group>
</div>
</div>
<!--邮寄到家-->
<div v-if="projectInfo.provideMode===3" class="van-cell-group--inset">
<van-cell>
<template #icon>
<van-icon class="van-cell__left-icon" name="location" color="red"></van-icon>
</template>
<template #title>
<div style="font-weight: bold;font-size: 15px">收货地址</div>
</template>
</van-cell>
<van-cell title="收获地址" is-link class="address-cell" @click="selectAddressPopup = true">
<template>
<span v-if="$.isEmptyObject(selectAddress)">请选择地址</span>
<span v-else>
{{selectAddress.province + selectAddress.city + selectAddress.county + selectAddress.address}}
</span>
</template>
</van-cell>
</div>
<!--电子签字-->
<div v-if="projectInfo.signMode===2" class="van-cell-group--inset">
<van-cell>
<template #icon>
<van-icon class="van-cell__left-icon" name="location" color="red"></van-icon>
</template>
<template #title>
<div style="font-weight: bold;font-size: 15px">电子签名</div>
</template>
</van-cell>
<van-cell title="">
<template #label>
<!-- <img v-if="mySignature"
@click="vant.ImagePreview({images:[mySignature],overlayStyle:{background:'#fff'},showIndex:false})"
:src="mySignature" style="height:350px;width: 100% " alt="">
<div v-else id="signature">
<van-tag type="danger" class="signature_reset" @click="resetSignature">重写</van-tag>
</div>-->
<div id="signature">
<van-tag type="danger" class="signature_reset" @click="resetSignature">重写</van-tag>
</div>
</template>
</van-cell>
</div>
<div v-if="
moment().valueOf() < moment(projectInfo.provideTimeEnd).valueOf()
&&
moment().valueOf() > moment(projectInfo.provideTimeStart).valueOf()"
style="margin: 20px 20px 10px 20px">
<van-button
@click="doReceive" style="border-radius: 10px" block type="info"
:color="themeColor">
{{isReceive?'重新选择':'选择'}}
</van-button>
</div>
</template>
<van-popup v-model="selectAddressPopup" closeable position="bottom" :style="{ height: '70%' }"
safe-area-inset-bottom>
<div style="height: 100%">
<div style="font-size: 15px;font-weight: bold;text-align: center;padding-top: 16px;">配送至</div>
<template v-if="addressList && addressList.length>0">
<van-cell v-for="item in addressList" icon="location-o" clickable
@click="selectAddress = item;selectAddressPopup=false">
<template #title>
{{item.address}}
</template>
<template #label>
<div>{{"地区:" + item.province + item.city + item.county}}</div>
<div>{{"收件人:" + item.name}}</div>
<div>{{"联系方式:" + item.tel}}</div>
</template>
</van-cell>
</template>
<van-empty v-else description="暂无地址"></van-empty>
<div style="position: absolute;bottom: 0;left: 0;box-sizing: border-box;width: 100%;padding: 0 16px;background: #fff">
<van-button @click="location.href = '/mobile/welfare/mine/address'" block round type="danger"
style="height: 40px;margin: 5px 0">
地址管理
</van-button>
</div>
</div>
</van-popup>
</div>
<script>
<!--#include("/mobile/welfare/include/mixins.js"){}#-->
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, welfareMixins],
data() {
return {
activeNames: [],
tabName: 'ing',
tarBarActive: 0,
projectId: null,
projectInfo: {},
welfareProvideMode: [],
welfareSignMode: [],
selectAddressPopup: false,
selectAddress: {},
mySignature: null,
userSign: {
data: null
},
imagePreview: false,
userSelection: []
}
},
methods: {
async findOne() {
const resp = await $.get('/mobile/welfare/list/findOne', {projectId: this.projectId})
if (resp.code === 0) {
if (resp.data.flexible) {
await this.getUserSelection()
await this.initSubject(resp.data)
}
this.projectInfo = resp.data
if (this.projectInfo.provideMode === 3) {
await this.selectAddressList()
const defaultAddress = this.addressList.find(v => v.isDefault)
this.selectAddress = defaultAddress ? defaultAddress : {}
}
if (this.projectInfo.signMode === 2) {
const resp = await $.get('/mobile/welfare/mine/getMySignature')
this.userSign = resp.data
setTimeout(() => {
$('#signature').jSignature({
width: '100%',
height: '100%',
lineWidth: 1
})
if (this.userSign.data) {
$('#signature').jSignature("setData", this.userSign.data)
}
}, 1000)
}
}
},
async initSubject(data) {
if (data.welfareProjectSubjects && data.welfareProjectSubjects.length > 0) {
data.welfareProjectSubjects && data.welfareProjectSubjects.forEach(v => {
if (v.subjectType === 'checkBox') {
if (this.userSelection && this.userSelection.length > 0) {
v.selection = this.userSelection.filter(s => s.subjectId === v.id).map(s => s.selectOptionId)
} else {
v.selection = []
}
}
if (v.subjectType === 'radio') {
if (this.userSelection && this.userSelection.length > 0) {
const selection = this.userSelection.find(s => s.subjectId === v.id)
if (selection) {
v.selection = selection.selectOptionId
}
} else {
v.selection = null
}
}
})
}
},
checkBoxToggle(checkBoxRefId) {
this.$refs[checkBoxRefId][0].toggle()
},
addressClick(item) {
this.selectAddress = item
},
validateOption(welfareProjectSubjects) {
return !welfareProjectSubjects.some(v => {
if (v.subjectType === 'checkBox' && v.selection.length === 0) {
return true
}
return v.subjectType === 'radio' && (v.selection === '' || v.selection == null);
})
},
resetSignature() {
$('#signature').jSignature('clear')
this.userSign.data = null
},
async saveSignature() {
const sign = $('#signature').jSignature("getData", "default")
this.userSign.data = sign
await $.post('/mobile/welfare/mine/saveMySignature', this.userSign)
},
async doReceive() {
// if (this.isReceive) {
// // this.$toast('您已领取,请勿重复领取!')
// // return
// const confirm = await vant.Dialog.confirm({
// title: '提示',
// message: '你确认要修改吗?',
// })
// if (!confirm) {
// return
// }
// }
const {flexible, provideMode, signMode, welfareProjectSubjects} = this.projectInfo
if (flexible && welfareProjectSubjects && welfareProjectSubjects.length > 0) {
if (!this.validateOption(welfareProjectSubjects)) {
this.$toast('请选择福利')
return
}
}
if (provideMode === 3 && $.isEmptyObject(this.selectAddress)) {
this.$toast('请选择收货地址')
return
}
/*if (signMode === 2 && !this.mySignature) {
this.$toast('请在我的页面签署电子签名后再领取')
return
}*/
if (signMode === 2 && $("#signature").jSignature('getData', 'native').length === 0 && !this.userSign.data) {
this.$toast('请先签字!')
return
}
let formData = {}
formData.projectId = this.projectInfo.id
formData.answers = JSON.stringify(this.projectInfo.welfareProjectSubjects)
const {province, city, county, address, name, tel} = this.selectAddress
formData.receiveAddress = "收获地址:" + province + city + county + address + "," + "收件人:" + name + "," + "联系方式:" + tel
formData.mySignature = this.userSign.data
let msg = this.isReceive ? '您确认要修改吗?' : '您确认要选择吗?'
const confirm = await vant.Dialog.confirm({
title: '标题',
message: msg,
})
if (confirm) {
const loading = this.$toast.loading({
message: '领取中...',
forbidClick: true,
overlay: true,
duration: 0
})
if (signMode === 2) {
this.saveSignature()
}
const resp = await $.post('/mobile/welfare/mine/doReceive', formData)
await this.getReceive()
loading.close()
if (resp.code === 0) {
window.location.href = '/mobile/welfare/list/receive_success?projectId=' + this.projectId + '&provideMode=' + this.projectInfo.provideMode
// this.$toast.success('领取成功')
}
}
},
async getUserSelection() {
const resp = await $.get('/mobile/welfare/mine/getUserSelection', {projectId: this.projectId})
this.userSelection = resp.data
},
viewDesc(optionId, desc) {
window.localStorage.setItem("welfare_option_desc_" + optionId, desc)
window.location.href = '/mobile/welfare/list/option_desc?optionId=' + optionId
}
},
mounted() {
},
async created() {
this.startLoading()
const id = GetQueryString("projectId")
if (id) {
this.projectId = id
this.findOne()
await this.getReceive()
this.welfareProvideMode = await getEnumOptions("WelfareProvideMode")
this.welfareSignMode = await getEnumOptions("WelfareSignMode")
}
this.closeLoading()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,68 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
#app {
background: #ffffff;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="领取结果" left-arrow
@click-left="back"></van-nav-bar>
</van-sticky>
<div style="text-align: center;margin-top: 200px;">
<svg t="1642388297798" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="3082" width="80" height="80">
<path d="M37.36963 583.753525a440.246475 430.879529 90 1 0 861.759058 0 440.246475 430.879529 90 1 0-861.759058 0Z"
fill="#07C160" p-id="3083"></path>
<path d="M247.376566 529.799914L391.065522 674.425565l299.742281-299.742281 59.948456 59.948456-359.690737 358.754043L187.240771 589.748371z"
fill="#FFFFFF" p-id="3084"></path>
<path d="M955.330366 240.548613h-83.927839a30.723584 30.723584 0 0 0-31.472939 30.161567v1.124034a30.910923 30.910923 0 0 0 30.348906 31.472939H955.330366a30.723584 30.723584 0 0 0 31.2856-30.348906v-1.124033A30.536245 30.536245 0 0 0 955.330366 240.548613z m-72.125487-168.605033a32.222295 32.222295 0 0 0-43.837308 4.121457L786.725333 141.071644a31.285601 31.285601 0 0 0 48.146104 39.903191l52.080221-64.819268a30.536245 30.536245 0 0 0-2.810084-42.900614zM683.126907 0.005433a30.910923 30.910923 0 0 0-31.47294 30.161567v84.864533a30.723584 30.723584 0 0 0 30.348906 31.285601h1.124034a30.536245 30.536245 0 0 0 31.2856-30.161567V31.291033A30.723584 30.723584 0 0 0 684.25094 0.005433z"
fill="#07C160" p-id="3085"></path>
</svg>
<div style="margin-top: 20px;">{{[1,4].includes(provideMode) ? '您已领取' : '您已选择'}}</div>
<div style="margin: 20px auto 0px auto;width: 300px;word-break: break-all">
礼品: {{selectOptionNames}}
</div>
<van-button style="margin-top: 20px;width: 100px" size="small" hairline type="primary" @click="back">返回
</van-button>
</div>
</div>
<script>
<!--#include("/mobile/welfare/include/mixins.js"){}#-->
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, welfareMixins],
data() {
return {
selectOptionNames: null
}
},
methods: {
async getUserSelection() {
const resp = await $.get('/mobile/welfare/mine/getUserSelect', {projectId: this.projectId})
this.selectOptionNames = resp.data
},
back() {
window.location.href = '/mobile/welfare/list/index'
}
},
created() {
const id = GetQueryString("projectId")
if (id) {
this.projectId = id
this.getUserSelection()
}
this.provideMode = GetQueryString("provideMode")
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,69 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.van-cell-group--inset {
margin: 0 16px;
overflow: hidden;
border-radius: 8px;
}
.bottom-button {
width: 160px;
height: 40px;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="地址管理" left-arrow
@click-left="location.href = '/mobile/welfare/mine/index'"></van-nav-bar>
</van-sticky>
<div v-if="vLoading && !vLoading.value">
<van-address-list
v-if="addressList && addressList.length>0 "
v-model="chosenAddressId"
:list="addressList"
default-tag-text="默认"
@add="onAdd"
@edit="onEdit"
></van-address-list>
<van-empty v-else description="暂无地址">
<van-button round type="danger" class="bottom-button" @click="onAdd">新增地址</van-button>
</van-empty>
</div>
</div>
<script>
<!--#include("/mobile/welfare/include/mixins.js"){}#-->
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, welfareMixins],
data() {
return {
chosenAddressId: null
}
},
methods: {
onAdd() {
window.location.href = '/mobile/welfare/mine/addressEdit'
},
onEdit(item, index) {
window.location.href = '/mobile/welfare/mine/addressEdit?id=' + item.id
}
},
async created() {
this.startLoading()
await this.selectAddressList()
this.closeLoading()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,103 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.van-cell-group--inset {
margin: 0 16px;
overflow: hidden;
border-radius: 8px;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="地址管理" left-arrow placeholder fixed
@click-left="location.href = '/mobile/welfare/mine/address'"></van-nav-bar>
</van-sticky>
<div v-if="vLoading && !vLoading.value">
<van-address-edit
ref="address"
:area-list="areaList"
:show-delete="addressId"
:address-info="addressInfo"
show-set-default
show-search-result
tel-maxlength="11"
:area-columns-placeholder="['请选择', '请选择', '请选择']"
@save="onSave"
@delete="onDelete"
></van-address-edit>
</div>
</div>
<script>
<!--#include("/mobile/welfare/include/areaList.js"){};include("/mobile/welfare/include/mixins.js"){}#-->
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, welfareMixins],
data() {
return {
areaList: areaList,
addressInfo: {},
addressId: null
};
},
methods: {
async onSave(content) {
const loading = this.$toast.loading({
message: '保存中...',
forbidClick: true,
overlay: true,
duration: 0
})
content.userName = content.name
const resp = await $.post('/mobile/welfare/mine/doSaveUserAddress', content)
loading.close()
if (resp.code === 0) {
this.$toast.success(resp.msg)
setTimeout(() => {
window.location.href = '/mobile/welfare/mine/address'
}, 1000)
}
},
async onDelete(content) {
const loading = this.$toast.loading({
message: '删除中...',
forbidClick: true,
overlay: true,
duration: 0
})
const resp = await $.post('/mobile/welfare/mine/deleteAddress', {id: content.id})
loading.close()
if (resp.code === 0) {
this.$toast.success(resp.msg)
setTimeout(() => {
window.location.href = '/mobile/welfare/mine/address'
}, 1000)
}
}
},
async created() {
this.startLoading()
this.addressId = GetQueryString("id") === '' ? null : GetQueryString("id")
if (this.addressId) {
const resp = await $.get('/mobile/welfare/mine/findOneUserAddress', {id: this.addressId})
if (resp.code === 0) {
this.addressInfo = resp.data
}
this.closeLoading()
} else {
this.addressInfo.name = "${@shiro.getPrincipalProperty('username')}";
this.closeLoading()
}
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,65 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.van-cell-group--inset {
margin: 0 16px;
overflow: hidden;
border-radius: 8px;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="个人信息" left-arrow placeholder fixed
@click-left="history.back()"></van-nav-bar>
</van-sticky>
<div class="mt10" v-if="vLoading && !vLoading.value">
<van-cell-group class="van-cell-group--inset">
<van-cell>
<template #title>
<div style="font-weight: bold;font-size: 15px">个人信息</div>
</template>
</van-cell>
<van-cell :border="false" is-link title="我的福利" url="/mobile/welfare/mine/myWelfare">
<template #icon>
<van-icon class="van-cell__left-icon" color="red" name="star"></van-icon>
</template>
</van-cell>
<van-cell :border="false" is-link title="我的地址" url="/mobile/welfare/mine/address">
<template #icon>
<van-icon class="van-cell__left-icon" color="red" name="location"></van-icon>
</template>
</van-cell>
<van-cell :border="false" is-link title="我的签名" url="/mobile/welfare/mine/sign">
<template #icon>
<van-icon class="van-cell__left-icon" color="red" name="coupon"></van-icon>
</template>
</van-cell>
</van-cell-group>
</div>
<!--#include("/mobile/welfare/include/tarbar.html"){}#-->
</div>
<script>
<!--#include("/mobile/welfare/include/mixins.js"){}#-->
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, welfareMixins],
data() {
return {
tarBarActive: 1
}
},
created() {
this.startLoading()
this.closeLoading()
}
})
</script>
<!--#
}
#-->
File diff suppressed because one or more lines are too long
@@ -0,0 +1,125 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
#app {
background: #FFFFFF;
}
#signature {
height: calc(100vh - 136px);
background: #fff;
border: 1px dashed grey;
margin: 10px;
}
.button-operation {
display: flex;
height: 50px;
align-items: center;
position: fixed;
bottom: 0;
width: 100%;
margin: 10px 0;
}
.button-operation > div {
flex: 1;
text-align: center;
margin: 0 10px;
}
.button-operation > div > button {
width: 100%;
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar title="我的签名" left-arrow
@click-left="location.href = '/mobile/welfare/mine/index'"></van-nav-bar>
</van-sticky>
<div id="signature"></div>
<div class="button-operation">
<div>
<van-button type="danger" @click="reset">重写</van-button>
</div>
<div>
<van-button type="info" @click="save">保存</van-button>
</div>
</div>
</div>
<script>
<!--#include("/mobile/welfare/include/mixins.js"){}#-->
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, welfareMixins],
data() {
return {
userSign: {
data: null
}
}
},
methods: {
reset() {
const val = $('#signature').jSignature("getData", "default")
$('#signature').jSignature('clear')
this.userSign.data = null
},
async save() {
const slength = $("#signature").jSignature('getData', 'native').length
if (slength === 0 && !this.userSign.data) {
this.$toast('请先签字!')
return
}
const loading = this.$toast.loading({
message: '保存中...',
forbidClick: true,
overlay: true,
duration: 0
})
this.userSign.data = $('#signature').jSignature("getData", "default")
const resp = await $.post('/mobile/welfare/mine/saveMySignature', this.userSign)
loading.close()
if (resp.code === 0) {
this.userSign = resp.data
this.$toast.success('保存成功!')
}
},
async getSignature() {
const resp = await $.get('/mobile/welfare/mine/getMySignature')
if (resp.code === 0) {
this.userSign = resp.data
if (this.userSign.data) {
$('#signature').jSignature("setData", resp.data.data)
// $('#signature').jSignature("importData", resp.data.data)
}
}
}
},
mounted() {
$('#signature').jSignature({
width: '100%',
height: '100%',
lineWidth: 1
})
document.body.addEventListener('touchmove', function (e) {
e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)
}, {passive: false}); //passive 参数不能省略,用来兼容ios和android
},
created() {
this.getSignature()
}
})
</script>
<!--#
}
#-->