881 lines
41 KiB
HTML
881 lines
41 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<!-- 在 head 标签中添加 meta 标签,并设置 viewport-fit=cover 值 -->
|
|
<meta name="viewport"
|
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
|
|
<title></title>
|
|
<!-- 引入样式文件 -->
|
|
<link rel="stylesheet" href="https://cdn.staticfile.org/vant/2.12.5/index.css">
|
|
<link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.2.0/weui.min.css">
|
|
|
|
<!-- 引入 Vue 和 Vant 的 JS 文件 -->
|
|
<script src="https://cdn.staticfile.org/vue/2.6.9/vue.min.js"></script>
|
|
<script src="https://cdn.staticfile.org/vant/2.12.5/vant.min.js"></script>
|
|
<script src="https://cdn.staticfile.org/jquery/1.10.0/jquery.min.js"></script>
|
|
<script src="/assets/platform/plugins/moment/moment.min.js"></script>
|
|
<script src="https://cdn.staticfile.org/js-cookie/2.2.1/js.cookie.min.js"></script>
|
|
|
|
</head>
|
|
|
|
|
|
<style>
|
|
html, body {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
margin: auto;
|
|
max-width: 600px;
|
|
background-color: white;
|
|
}
|
|
|
|
html::-webkit-scrollbar {
|
|
display: none
|
|
}
|
|
|
|
[v-clock] {
|
|
display: none
|
|
}
|
|
|
|
html, body {
|
|
font-family: PingFang SC, 'Helvetica Neue', Arial, sans-serif;
|
|
}
|
|
|
|
.page-v {
|
|
width: 100%;
|
|
position: relative;
|
|
margin-bottom: 50px;
|
|
}
|
|
|
|
.detail-v {
|
|
margin-top: 15px;
|
|
padding-bottom: 30px;
|
|
}
|
|
|
|
.p15 {
|
|
padding: 0 15px;
|
|
}
|
|
|
|
.title-v {
|
|
margin: 10px 0;
|
|
}
|
|
|
|
.form-v {
|
|
/*margin-top: 20px;*/
|
|
}
|
|
|
|
.van-doc-demo-block__title {
|
|
margin: 0;
|
|
padding: 0 16px;
|
|
color: rgba(69, 90, 100, 0.6);
|
|
font-weight: normal;
|
|
font-size: 14px;
|
|
line-height: 16px;
|
|
}
|
|
|
|
.goods-card {
|
|
margin: 0;
|
|
background-color: white;
|
|
}
|
|
|
|
.delete-button {
|
|
height: 100%;
|
|
}
|
|
|
|
.van-swipe-cell__wrapper {
|
|
border: none;
|
|
}
|
|
|
|
.weui-msg {
|
|
background-color: transparent;
|
|
}
|
|
|
|
.van-nav-bar__content {
|
|
background-color: #1867b0;
|
|
}
|
|
|
|
.van-nav-bar__title, .van-icon-arrow-left::before {
|
|
color: white;
|
|
}
|
|
</style>
|
|
<body>
|
|
<div v-clock id="app" v-if="showPage">
|
|
<van-nav-bar title="教工作品征集" fixed placeholder safe-area-inset-top @click-left="history.back()"
|
|
:left-arrow="leftArrow"></van-nav-bar>
|
|
<div>
|
|
<van-swipe v-if="boxData.files&&boxData.files.length>0" class="my-swipe" :autoplay="3000"
|
|
indicator-color="white">
|
|
<van-swipe-item v-for="bgi in boxData.files">
|
|
<van-image
|
|
width="100%"
|
|
height="200px"
|
|
fit="cover"
|
|
:src="FILE_DOMAIN+'/fileStreamPreview?id='+bgi.id"
|
|
></van-image>
|
|
</van-swipe-item>
|
|
</van-swipe>
|
|
<van-image
|
|
v-else
|
|
width="100%"
|
|
height="200px"
|
|
fit="cover"
|
|
src="***"
|
|
>
|
|
<template v-slot:error>封面图片</template>
|
|
</van-image>
|
|
</div>
|
|
<div v-if="active==0" class="page-v">
|
|
<div class="detail-v">
|
|
<div class="title-v p15">
|
|
<h3 :style="'color: '+boxData.hdcolor">活动介绍</h3>
|
|
<div class="van-hairline--top"></div>
|
|
<br/>
|
|
</div>
|
|
<div class="p15">
|
|
<div v-html="boxData.hdjs"></div>
|
|
</div>
|
|
<div class="title-v p15">
|
|
<br/>
|
|
<h3 :style="'color: '+boxData.hdcolor">参加人员</h3>
|
|
<div class="van-hairline--top"></div>
|
|
<br/>
|
|
</div>
|
|
<div class="p15">
|
|
<div v-html="boxData.hdcjry"></div>
|
|
</div>
|
|
<div class="title-v p15">
|
|
<br/>
|
|
<h3 :style="'color: '+boxData.hdcolor">奖励方式</h3>
|
|
<div class="van-hairline--top"></div>
|
|
<br/>
|
|
</div>
|
|
<div class="p15">
|
|
<div v-html="boxData.hdjlfs"></div>
|
|
</div>
|
|
<div class="title-v p15">
|
|
<br/>
|
|
<h3 :style="'color: '+boxData.hdcolor">活动内容</h3>
|
|
<div class="van-hairline--top"></div>
|
|
<br/>
|
|
</div>
|
|
<div class="p15">
|
|
<div v-html="boxData.hdnr"></div>
|
|
</div>
|
|
<div class="title-v p15">
|
|
<br/>
|
|
<h3 :style="'color: '+boxData.hdcolor">活动联系人</h3>
|
|
<div class="van-hairline--top"></div>
|
|
<br/>
|
|
</div>
|
|
<div class="p15" style="line-height:24pt;">
|
|
<div v-html="boxData.hdlxr"></div>
|
|
</div>
|
|
<div class="title-v p15" v-if="!isNull(boxData.hdother.replace(/<.*?>/g,''))">
|
|
<br/>
|
|
<h3 :style="'color: '+boxData.hdcolor">其他</h3>
|
|
<div class="van-hairline--top"></div>
|
|
<br/>
|
|
</div>
|
|
<div class="p15" style="line-height:24pt;"
|
|
v-if="!isNull(boxData.hdother.replace(/<.*?>/g,''))">
|
|
<div v-html="boxData.hdother"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div v-if="active==1" class="page-v">
|
|
<div class="detail-v" style="margin-top: 0">
|
|
<div class="weui-msg" v-if="showMsg">
|
|
<div class="weui-msg__icon-area">
|
|
<van-circle
|
|
layer-color="rgb(240,240,240)"
|
|
color="#07c160"
|
|
stroke-width="50"
|
|
v-if="showPlan"
|
|
v-model="percent"
|
|
:rate="percent"
|
|
:clockwise="false"
|
|
:text="percent+' %'"
|
|
></van-circle>
|
|
<span v-if="showPlan==false">
|
|
<i v-if="flag" class="weui-icon-success weui-icon_msg"></i>
|
|
<i v-if="!flag" class="weui-icon-warn weui-icon_msg"></i>
|
|
</span>
|
|
|
|
</div>
|
|
<div class="weui-msg__text-area">
|
|
<h2 class="weui-msg__title" v-if="showPlan">上传中...</h2>
|
|
<h2 class="weui-msg__title" v-if="!showPlan&&flag">上传成功!</h2>
|
|
<h2 class="weui-msg__title" v-if="!showPlan&&!flag">上传失败!</h2>
|
|
<div v-html="msg"></div>
|
|
</div>
|
|
<div class="weui-msg__opr-area">
|
|
<p class="weui-btn-area">
|
|
<a v-if="!showPlan" @click="showMsg=false"
|
|
:class="flag?'weui-btn weui-btn_primary':'weui-btn weui-btn_warn'">{{flag ? '确定' : '返回'}}</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="form-v" v-else>
|
|
<van-form>
|
|
<div style="width: 100%;padding: 16px 0;">
|
|
<h2 class="van-doc-demo-block__title"
|
|
:style="'font-weight: bolder;color: '+boxData.hdcolor">
|
|
基本信息</h2>
|
|
</div>
|
|
<van-cell-group>
|
|
<van-field
|
|
v-model="formData.loginname"
|
|
readonly
|
|
name="工资号"
|
|
label="工资号"
|
|
placeholder="工资号"
|
|
></van-field>
|
|
<van-field
|
|
readonly
|
|
v-model="formData.username"
|
|
name="姓名"
|
|
label="姓  名"
|
|
></van-field>
|
|
<van-field
|
|
readonly
|
|
v-model="formData.unitname"
|
|
name="所属单位"
|
|
label="所属单位"
|
|
></van-field>
|
|
<van-field
|
|
required
|
|
v-model="formData.mobile"
|
|
name="mobile"
|
|
label="手机号码" type="tel"
|
|
placeholder="手机号码"
|
|
:rules="[{ required: true, message: '请填写手机号码' }]"
|
|
></van-field>
|
|
</van-cell-group>
|
|
</van-cell-group>
|
|
<div style="width: 100%;padding: 16px 0;">
|
|
<span class="van-doc-demo-block__title"
|
|
:style="'font-weight: bolder;color: '+boxData.hdcolor">
|
|
作品信息</span>
|
|
<p class="van-doc-demo-block__title" style="margin-top: 5px;color: red">
|
|
(如同时参加以下多个活动,或有多个主题,请分别提交)</p>
|
|
</div>
|
|
<van-tabs v-model="formData.hdlb_i" :color="boxData.hdcolor" type="card">
|
|
<van-tab v-for="lb,i in boxData.lbs" :name="i" :title="lb.lname">
|
|
<div v-if="formData.hdlb_i==i">
|
|
<!-- <van-field style="padding-top: 30px" maxlength="15"
|
|
:rules="[{ required: true, message: '请填写作品主题' }]"
|
|
v-model="fd[i].zpzt"
|
|
required
|
|
show-word-limit
|
|
label="作品主题" placeholder="主题"></van-field>-->
|
|
<van-field
|
|
v-if="lb.zplbs&&lb.zplbs.length>0"
|
|
required
|
|
readonly
|
|
clickable
|
|
name="picker"
|
|
:value="fd[i].zplb_name"
|
|
label="类别"
|
|
placeholder="点击选择类别"
|
|
@click="showPicker = true"
|
|
:rules="[{ required: true, message: '请选择类别' }]"
|
|
></van-field>
|
|
<van-popup v-model="showPicker" position="bottom">
|
|
<van-picker
|
|
show-toolbar
|
|
value-key="zname"
|
|
:columns="lb.zplbs"
|
|
@confirm="(val) => {zplbClick(val, fd, i)}"
|
|
@cancel="showPicker = false"
|
|
></van-picker>
|
|
</van-popup>
|
|
<van-field
|
|
required
|
|
v-model="fd[i].zpmc"
|
|
name="zpmc"
|
|
label="标题"
|
|
placeholder="请填写标题"
|
|
:rules="[{ required: true, message: '请填写标题' }]"
|
|
></van-field>
|
|
|
|
<van-field type="textarea" show-word-limit autosize
|
|
:maxlength="chooseLb.maxWordCount ? chooseLb.maxWordCount : 100"
|
|
v-model="fd[i].zpms"
|
|
label="介绍"
|
|
placeholder="请填写介绍"></van-field>
|
|
<van-field type="digit" show-word-limit maxlength="10" autosize
|
|
v-model="fd[i].step_count"
|
|
v-if="lb.lname==='健步走'"
|
|
label="健步走步数"
|
|
placeholder="健步走步数"
|
|
:rules="[{ required: true, message: '请填写健步走步数' }]"></van-field>
|
|
|
|
<template v-if="chooseLb.isUploadPhoto === true">
|
|
<van-field label="图  片" readonly placeholder="(左滑删除单个文件)"
|
|
style="border: none;" required
|
|
input-align="right"></van-field>
|
|
<van-swipe-cell v-for="img,idx in fd[i].imgList"
|
|
style="border: none;padding-top: 20px;">
|
|
<van-row style="padding: 0 15px">
|
|
<van-col :span="6">
|
|
<van-image
|
|
width="100%"
|
|
height="25vw"
|
|
fit="cover"
|
|
:src="img.content"
|
|
></van-image>
|
|
</van-col>
|
|
</van-row>
|
|
|
|
<van-button
|
|
native-type="button"
|
|
@click="imgDelete(idx,i,img.filepath)"
|
|
slot="right"
|
|
square
|
|
text="删除"
|
|
type="danger"
|
|
class="delete-button"
|
|
></van-button>
|
|
</van-swipe-cell>
|
|
<van-field>
|
|
<template #input>
|
|
<van-uploader multiple :preview-image="false"
|
|
:before-read="beforeReadImg"
|
|
accept="image/*"
|
|
:max-count="chooseLb.photoNum"
|
|
@oversize="$toast('图片大小不能超过' + chooseLb.photoSize + 'M')"
|
|
:max-size="chooseLb.photoSize * 1048576"
|
|
v-model="fd[i].imgList">
|
|
</van-uploader>
|
|
</template>
|
|
</van-field>
|
|
<div style="margin-top: 10px;padding-left: 20px;font-size: 12px;color: rgb(160,160,160)">
|
|
注意:图片最多{{ chooseLb.photoNum }}张,每张不超过{{ chooseLb.photoSize }}M,格式为{{chooseLb.photoType.toString()}}。
|
|
</div>
|
|
</template>
|
|
|
|
<template v-if="chooseLb.isUploadOther === true">
|
|
<van-field label-width="150" label="音/视频、文档" readonly
|
|
style="border: none;" required
|
|
input-align="right"></van-field>
|
|
<van-swipe-cell v-for="(video,idx) in fd[i].videoList"
|
|
style="border: none;padding-top: 20px;">
|
|
<van-row style="padding: 0 15px">
|
|
<van-col :span="6">
|
|
<van-image
|
|
width="100%"
|
|
height="25vw"
|
|
fit="cover"
|
|
src="1"
|
|
>
|
|
<template v-slot:error>
|
|
<i class="van-icon van-icon-description van-uploader__file-icon">
|
|
<!----></i>
|
|
<div class="van-uploader__file-name van-ellipsis">
|
|
|
|
{{video.filename ? video.filename : video.file.name
|
|
}}
|
|
</div>
|
|
</template>
|
|
</van-image>
|
|
</van-col>
|
|
</van-row>
|
|
|
|
<van-button
|
|
native-type="button"
|
|
@click="videoDelete(idx,i,video.filepath)"
|
|
slot="right"
|
|
square
|
|
text="删除"
|
|
type="danger"
|
|
class="delete-button"
|
|
></van-button>
|
|
</van-swipe-cell>
|
|
<van-field v-if="lb.lname!=='健步走'">
|
|
<template #input>
|
|
<van-uploader :preview-image="false" result-type="file"
|
|
@oversize="$toast('文件大小不能超过' + chooseLb.otherSize + 'M')"
|
|
:max-size="chooseLb.otherSize * 1048576"
|
|
:before-read="beforeReadVideo" accept="*"
|
|
:max-count="chooseLb.otherFileNum"
|
|
v-model="fd[i].videoList"></van-uploader>
|
|
</template>
|
|
</van-field>
|
|
<div style="margin-top: 10px;padding-left: 20px;font-size: 12px;color: rgb(160,160,160)">
|
|
注意:文件最多{{ chooseLb.otherFileNum }}个,每个不超过{{ chooseLb.otherSize }}M,格式为{{chooseLb.otherType.toString()}}。
|
|
</div>
|
|
</template>
|
|
|
|
</div>
|
|
</van-tab>
|
|
</van-tabs>
|
|
|
|
<div style="margin: 16px;">
|
|
<van-row gutter="20">
|
|
<van-col span="12">
|
|
<van-button :disabled="subDis" plain round block
|
|
:color="boxData.hdcolor"
|
|
type="info"
|
|
@click="doSubmit(false)">
|
|
保存
|
|
</van-button>
|
|
</van-col>
|
|
<van-col span="12">
|
|
<van-button :disabled="subDis" round block :color="boxData.hdcolor"
|
|
type="info"
|
|
@click="doSubmit(true)">
|
|
提交
|
|
</van-button>
|
|
</van-col>
|
|
|
|
</van-row>
|
|
|
|
|
|
</div>
|
|
</van-form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<van-tabbar
|
|
style="max-width: 600px;position: fixed;left: 0;bottom: 0;right: 0;margin: auto"
|
|
v-model="active"
|
|
:active-color="boxData.hdcolor"
|
|
inactive-color="#000"
|
|
@change="activeChange"
|
|
>
|
|
<van-tabbar-item icon="label-o">介绍</van-tabbar-item>
|
|
<van-tabbar-item icon="edit" >参加活动</van-tabbar-item>
|
|
</van-tabbar>
|
|
<van-number-keyboard safe-area-inset-bottom/>
|
|
</div>
|
|
<script>
|
|
const FILE_DOMAIN = "${AppFileDomain!}"
|
|
|
|
function getQueryVariable(variable) {
|
|
var query = window.location.search.substring(1);
|
|
var vars = query.split("&");
|
|
for (var i = 0; i < vars.length; i++) {
|
|
var pair = vars[i].split("=");
|
|
if (pair[0] == variable) {
|
|
return pair[1];
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
var xhrOnProgress = function (fun) {
|
|
xhrOnProgress.onprogress = fun; //绑定监听
|
|
//使用闭包实现监听绑
|
|
return function () {
|
|
//通过$.ajaxSettings.xhr();获得XMLHttpRequest对象
|
|
var xhr = $.ajaxSettings.xhr();
|
|
//判断监听函数是否为函数
|
|
if (typeof xhrOnProgress.onprogress !== 'function')
|
|
return xhr;
|
|
//如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
|
|
if (xhrOnProgress.onprogress && xhr.upload) {
|
|
xhr.upload.onprogress = xhrOnProgress.onprogress;
|
|
}
|
|
return xhr;
|
|
}
|
|
}
|
|
|
|
function getSuffix(filename) {
|
|
return /\.[^\.]+$/.exec(filename)
|
|
}
|
|
|
|
var vue = new Vue({
|
|
el: "#app",
|
|
data: function () {
|
|
return {
|
|
readytodelfile: [],
|
|
leftArrow: false,
|
|
boxData: {},
|
|
subDis: false,
|
|
showPage: false,
|
|
showPicker: false,
|
|
showMsg: false,
|
|
percent: 0,
|
|
flag: true,
|
|
showPlan: true,
|
|
msg: '',
|
|
formData: {
|
|
hdlb_i: 0,
|
|
},
|
|
fd: [],
|
|
active: 0,
|
|
isNull(val) {
|
|
if (val === null || val === undefined || val === '') {
|
|
return true
|
|
}
|
|
return false
|
|
},
|
|
imgtype: ['gif', 'jpg', 'png', 'jpeg'],
|
|
audiotype: ['mp3', 'wma', 'flac', 'wav', 'm4a', 'amr', 'au'],
|
|
doctype: ['doc', 'docx', 'xlsx', 'xls', 'txt'],
|
|
videotype: ['flv', 'swf', 'mkv', 'avi', 'rm', 'rmvb', 'wmv', 'mp4', 'mov', 'mpg', 'mpeg', 'quicktime'],
|
|
chooseLb: {},
|
|
}
|
|
},
|
|
methods: {
|
|
zplbClick(val, fd, i) {
|
|
this.chooseLb = val
|
|
console.log(this.chooseLb)
|
|
fd[i].zplb = val.zid;
|
|
fd[i].zplb_name = val.zname;
|
|
this.showPicker = false
|
|
},
|
|
activeChange(){
|
|
if (this.subDis){
|
|
this.active=0
|
|
this.$toast.fail("不在活动时间范围内!");
|
|
}
|
|
},
|
|
imgDelete(idx, i, filepath) {
|
|
this.fd[i].imgList.splice(idx, 1)
|
|
this.readytodelfile.push(filepath);
|
|
},
|
|
videoDelete(idx, i, filepath) {
|
|
this.fd[i].videoList.splice(idx, 1)
|
|
this.readytodelfile.push(filepath);
|
|
}
|
|
,
|
|
onConfirm(value) {
|
|
this.formData.hdzplx2 = value.zname;
|
|
this.showPicker = false;
|
|
}
|
|
,
|
|
getPlaceholder(formData, key) {
|
|
if (this.isNull(formData.userid)) {
|
|
return "输入工资号后自动匹配"
|
|
} else {
|
|
if (this.isNull(formData[key])) {
|
|
return '暂无'
|
|
}
|
|
return formData[key]
|
|
}
|
|
}
|
|
,
|
|
async initUserInfo() {
|
|
const userId = "${@shiro.getPrincipalProperty('id')}"
|
|
const loginName = "${@shiro.getPrincipalProperty('loginname')}"
|
|
const userName = "${@shiro.getPrincipalProperty('username')}"
|
|
const unitName = "${@shiro.getPrincipalProperty('unit').getName()}"
|
|
this.$set(this.formData, 'loginname', loginName)
|
|
this.$set(this.formData, 'username', userName)
|
|
this.$set(this.formData, 'unitname', unitName)
|
|
this.$set(this.formData, 'userid', userId)
|
|
this.$set(this.formData, 'mobile', "${@shiro.getPrincipalProperty('mobile')}")
|
|
},
|
|
async doSubmit(flag) {
|
|
if (this.isNull(this.formData.userid)) {
|
|
this.$toast.fail("请正确填写您的工资号!")
|
|
return
|
|
}
|
|
const i = this.formData.hdlb_i
|
|
|
|
if(flag === true) {
|
|
if(this.chooseLb.isUploadPhoto === true || this.chooseLb.isUploadOther === true) {
|
|
if (this.fd[i].videoList.length == 0 || this.fd[i].imgList.length == 0) {
|
|
this.$toast.fail("请您选择要上传的作品!")
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
const msg = '您当前选择的是“' + this.boxData.lbs[i].lname + '”,是否确认上传?' + (flag ? '上传后您将不能对已上传的作品进行更改' : '保存后如需提交请到我的作品进行提交')
|
|
const confirm = await this.$dialog.confirm({
|
|
title: '提醒',
|
|
message: msg
|
|
})
|
|
if (confirm === "confirm") {
|
|
setTimeout(() => {
|
|
this.showMsg = true
|
|
this.showPlan = true
|
|
this.percent = 0
|
|
this.msg = ''
|
|
|
|
let formData1 = {}
|
|
let formData2 = new FormData();
|
|
formData1.flag = flag
|
|
formData2.append("flag", flag)
|
|
if (this.formData.id) {
|
|
|
|
this.$set(formData1, "id", getQueryVariable("zpid"))
|
|
this.$set(formData1, "hdid", getQueryVariable("id"))
|
|
this.$set(formData1, "hdsbrid", this.isNull(this.formData.userid) ? '' : this.formData.userid)
|
|
this.$set(formData1, "mobile", this.isNull(this.formData.mobile) ? '' : this.formData.mobile)
|
|
this.$set(formData1, "step_count", this.isNull(this.fd[i].step_count) ? '' : this.fd[i].step_count)
|
|
this.$set(formData1, "zpmc", this.isNull(this.fd[i].zpmc) ? '' : this.fd[i].zpmc)
|
|
this.$set(formData1, "hdzplx", this.isNull(this.boxData.lbs[i].lid) ? '' : this.boxData.lbs[i].lid)
|
|
this.$set(formData1, "hdzplx2", this.isNull(this.fd[i].zplb) ? '' : this.fd[i].zplb)
|
|
this.$set(formData1, "hdsbzpzt", this.isNull(this.fd[i].zpzt) ? '' : this.fd[i].zpzt)
|
|
this.$set(formData1, "hdsbzpms", this.isNull(this.fd[i].zpms) ? '' : this.fd[i].zpms)
|
|
//this.$set(formData1, "hdsbsj", moment().format('YYYY-MM-DD HH:mm:ss'))
|
|
} else {
|
|
|
|
formData2.append("hdid", getQueryVariable("id"))
|
|
formData2.append("hdsbrid", this.isNull(this.formData.userid) ? '' : this.formData.userid);
|
|
formData2.append("mobile", this.isNull(this.formData.mobile) ? '' : this.formData.mobile);
|
|
formData2.append("step_count", this.isNull(this.fd[i].step_count) ? '' : this.fd[i].step_count);
|
|
formData2.append("zpmc", this.isNull(this.fd[i].zpmc) ? '' : this.fd[i].zpmc);
|
|
formData2.append("hdzplx", this.isNull(this.boxData.lbs[i].lid) ? '' : this.boxData.lbs[i].lid)
|
|
formData2.append("hdzplx2", this.isNull(this.fd[i].zplb) ? '' : this.fd[i].zplb);
|
|
formData2.append("hdsbzpzt", this.isNull(this.fd[i].zpzt) ? '' : this.fd[i].zpzt);
|
|
formData2.append("hdsbzpms", this.isNull(this.fd[i].zpms) ? '' : this.fd[i].zpms);
|
|
this.fd[i].imgList.forEach(val => {
|
|
formData2.append("files", val.file, this.isNull(val.ms) ? val.file.name : val.ms + getSuffix(val.file.name));
|
|
});
|
|
this.fd[i].videoList.forEach(val => {
|
|
formData2.append("files", val.file, this.isNull(val.ms) ? val.file.name : val.ms + getSuffix(val.file.name));
|
|
})
|
|
formData2.append("hdsbsj", moment().format('YYYY-MM-DD HH:mm:ss'));
|
|
}
|
|
if (!this.isNull(this.formData.id)) {
|
|
formData2.append("data", JSON.stringify(formData1));
|
|
formData2.append("flag", flag);
|
|
formData2.append("readytodelfile", JSON.stringify(this.readytodelfile));
|
|
this.fd[i].imgList.forEach(val => {
|
|
formData2.append("file", val.file);
|
|
});
|
|
this.fd[i].videoList.forEach(val => {
|
|
formData2.append("file", val.file);
|
|
});
|
|
$.ajax({
|
|
url: "/platform/hd/jzghd/sczp/doEdit",
|
|
type: "post",
|
|
data: formData2,
|
|
processData: false,
|
|
contentType: false,
|
|
xhr: xhrOnProgress((e) => {
|
|
if (e.total == 0) {
|
|
this.percent = 0
|
|
} else {
|
|
this.percent = ((e.loaded / e.total) * 100).toFixed(0);//文件上传百分比
|
|
}
|
|
|
|
}), success: function (data) {
|
|
if (data.code === 0) {
|
|
vue.fd[i].zplb = ''
|
|
vue.fd[i].zplb_name = ''
|
|
vue.fd[i].zpzt = ''
|
|
vue.fd[i].zpms = ''
|
|
vue.fd[i].step_count = ''
|
|
vue.fd[i].zpmc = ''
|
|
vue.fd[i].sbsj = ''
|
|
vue.fd[i].imgList = []
|
|
vue.fd[i].videoList = []
|
|
vue.fd[i].audioList = []
|
|
Cookies.remove('sa_formData');
|
|
|
|
|
|
vue.msg = '<p class="weui-msg__desc">我们已收到您的作品!<br/>非常感谢您的支持!</p>'
|
|
this.flag = true
|
|
|
|
|
|
} else {
|
|
|
|
vue.msg = '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>'
|
|
this.flag = false
|
|
}
|
|
vue.showPlan = false
|
|
location.href = '/mobile/wmhd/list'
|
|
},
|
|
error: function (data) {
|
|
vue.msg = '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>'
|
|
this.flag = false
|
|
vue.showPlan = false
|
|
}
|
|
})
|
|
} else {
|
|
|
|
$.ajax({
|
|
url: "/platform/staffActivities/doSubmit",
|
|
type: "post",
|
|
data: formData2,
|
|
processData: false,
|
|
contentType: false,
|
|
xhr: xhrOnProgress((e) => {
|
|
if (e.total == 0) {
|
|
this.percent = 0
|
|
} else {
|
|
this.percent = ((e.loaded / e.total) * 100).toFixed(0);//文件上传百分比
|
|
}
|
|
|
|
}),
|
|
success: function (data) {
|
|
if (data.code === 0) {
|
|
vue.fd[i].zplb = ''
|
|
vue.fd[i].zplb_name = ''
|
|
vue.fd[i].zpzt = ''
|
|
vue.fd[i].zpms = ''
|
|
vue.fd[i].step_count = ''
|
|
vue.fd[i].zpmc = ''
|
|
vue.fd[i].sbsj = ''
|
|
vue.fd[i].imgList = []
|
|
vue.fd[i].videoList = []
|
|
vue.fd[i].audioList = []
|
|
Cookies.remove('sa_formData');
|
|
|
|
|
|
vue.msg = '<p class="weui-msg__desc">我们已收到您的作品!<br/>非常感谢您的支持!</p>'
|
|
|
|
this.flag = true
|
|
} else {
|
|
|
|
vue.msg = '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>'
|
|
this.flag = false
|
|
}
|
|
vue.showPlan = false
|
|
},
|
|
error: function (data) {
|
|
vue.msg = '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>'
|
|
this.flag = false
|
|
vue.showPlan = false
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
}, 500)
|
|
}
|
|
|
|
|
|
}
|
|
,
|
|
// 返回布尔值
|
|
beforeReadImg: function (file) {
|
|
var suffix = getSuffix(file.name)
|
|
if (suffix == null) {
|
|
this.$toast('获取不到后缀名!')
|
|
return false
|
|
}
|
|
const suf = file.name.split('.').pop().toLowerCase()
|
|
if(this.chooseLb.photoType.indexOf(suf) === -1) {
|
|
this.$toast('支持的图片类型:' + this.chooseLb.photoType.toString())
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
,
|
|
// 返回布尔值
|
|
beforeReadVideo: function (file, detail) {
|
|
var suffix = getSuffix(file.name)
|
|
if (suffix == null) {
|
|
this.$toast('获取不到后缀名!')
|
|
return false
|
|
}
|
|
const suf = file.name.split('.').pop().toLowerCase()
|
|
if(this.chooseLb.otherType.indexOf(suf) === -1) {
|
|
this.$toast('支持的文件类型:' + this.chooseLb.otherType.toString())
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
,
|
|
},
|
|
async created() {
|
|
this.initUserInfo()
|
|
const zpid = GetQueryString("zpid")
|
|
GetQueryString("client") === "mobile" ? this.leftArrow = true : this.leftArrow = false
|
|
|
|
if (window.innerWidth > 800) {
|
|
this.$notify({type: 'warning', message: '当前窗口宽度过大!部分区域显示会出现大小偏差'});
|
|
}
|
|
|
|
if (!this.isNull(getQueryVariable("id"))) {
|
|
const data = await $.get("/platform/hd/wmhdMange/findOne", {hdid: getQueryVariable("id")})
|
|
if (data.code == 0) {
|
|
document.getElementsByTagName("title")[0].innerText = data.data.hdname;
|
|
data.data.lbs.forEach((lb, idx) => {
|
|
this.fd.push({
|
|
zpzt: '',
|
|
zpms: '',
|
|
zplb: '',
|
|
imgList: [],
|
|
videoList: [],
|
|
})
|
|
})
|
|
this.boxData = data.data
|
|
this.formData.hdlb_i = 0
|
|
this.showPage = true
|
|
|
|
if (!data.data.hdflag) {
|
|
this.$toast.fail("当前活动未开启!");
|
|
this.subDis = true
|
|
} else {
|
|
if (!(new Date(data.data.hdkssj.replace(/-/g, '/')).getTime() < new Date().getTime() && new Date().getTime() < new Date(data.data.hdjssj.replace(/-/g, '/')).getTime())) {
|
|
this.$toast.fail("不在活动时间范围内!");
|
|
this.subDis = true
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
if (!this.isNull(zpid)) {
|
|
const {data, code, msg} = await $.get("/platform/hd/wmhd/findOneById", {id: zpid})
|
|
const refs = await $.get("/mobile/wmhd/list/findOne", {id: zpid})
|
|
this.$set(this.formData, "id", refs[0].id)
|
|
this.$set(this.formData, "userid", refs[0].hdsbrid)
|
|
this.$set(this.formData, "mobile", refs[0].mobile)
|
|
this.$set(this.formData, "hdlb_i", refs[0].llocation - 1)
|
|
this.$set(this.fd[refs[0].llocation - 1], "step_count", this.isNull(refs[0].step_count) ? "" : refs[0].step_count)
|
|
this.$set(this.fd[refs[0].llocation - 1], "zpmc", this.isNull(refs[0].zpmc) ? "" : refs[0].zpmc)
|
|
this.$set(this.boxData.lbs[refs[0].llocation - 1], "lid", refs[0].hdzplx)
|
|
this.$set(this.fd[refs[0].llocation - 1], "zplb", refs[0].hdzplx2)
|
|
this.$set(this.fd[refs[0].llocation - 1], "zplb_name", refs[0].zname)
|
|
this.$set(this.fd[refs[0].llocation - 1], "zpzt", refs[0].hdsbzpzt)
|
|
this.$set(this.fd[refs[0].llocation - 1], "hdsbsj", refs[0].hdsbsj)
|
|
this.$set(this.fd[refs[0].llocation - 1], "zpms", refs[0].hdsbzpms)
|
|
const o = this.boxData.lbs[0].zplbs.find(o => o.zid === refs[0].hdzplx2)
|
|
|
|
console.log(o)
|
|
this.chooseLb = o !== undefined ? o : {}
|
|
data.forEach((v, i) => {
|
|
v.filename = v.filename
|
|
v.fjurl = v.filepath
|
|
v.url = FILE_DOMAIN + "/fileStreamPreview?id=" + v.id
|
|
v.content = FILE_DOMAIN + "/fileStreamPreview?id=" + v.id
|
|
const filetype = v.filename.substring(v.filename.lastIndexOf(".") + 1)
|
|
const aa = this.audiotype.concat(this.videotype)
|
|
const bb = this.doctype.concat(this.doctype)
|
|
if (this.imgtype.indexOf(filetype) > -1) {
|
|
this.fd[refs[0].llocation - 1].imgList.push(v)
|
|
} else if (aa.indexOf(filetype) > -1) {
|
|
this.fd[refs[0].llocation - 1].videoList.push(v);
|
|
} else if (bb.indexOf(filetype) > -1) {
|
|
this.fd[refs[0].llocation - 1].videoList.push(v);
|
|
}
|
|
})
|
|
|
|
|
|
}
|
|
|
|
/* if (Cookies.get("sa_formData") != undefined) {
|
|
this.formData = JSON.parse(Cookies.get("sa_formData"))
|
|
Cookies.remove('sa_formData');
|
|
}*/
|
|
|
|
/*setInterval(() => {
|
|
Cookies.set("sa_formData", JSON.stringify(this.formData))
|
|
}, 1000)*/
|
|
|
|
}
|
|
})
|
|
|
|
function GetQueryString(name) {
|
|
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
|
const r = window.location.search.substr(1).match(reg);
|
|
if (r != null) return unescape(r[2]);
|
|
return "";
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|