|
@@ -0,0 +1,851 @@
|
|
|
|
+<!DOCTYPE html>
|
|
|
|
+<html lang="zh-cn">
|
|
|
|
+<head>
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
|
|
|
+ <meta name="format-detection" content="email=no" />
|
|
|
|
+ <meta name="format-detection" content="telephone=no" />
|
|
|
|
+ <title>任务反馈</title>
|
|
|
|
+ <link rel="stylesheet" href="../css/reset.css">
|
|
|
|
+ <link rel="stylesheet" href="../css/style.css">
|
|
|
|
+ <style>
|
|
|
|
+ html{font-size:10px}
|
|
|
|
+ html,body{
|
|
|
|
+ height: 100%;
|
|
|
|
+ overflow: auto;
|
|
|
|
+ }
|
|
|
|
+ .flex-wrap{
|
|
|
|
+ display: -webkit-box;
|
|
|
|
+ display: -webkit-flex;
|
|
|
|
+ display: flex;
|
|
|
|
+ }
|
|
|
|
+ .flex-con{
|
|
|
|
+ -webkit-box-flex: 1;
|
|
|
|
+ -webkit-flex: 1;
|
|
|
|
+ flex: 1;
|
|
|
|
+ }
|
|
|
|
+ body{
|
|
|
|
+ display: -webkit-box;
|
|
|
|
+ display: -webkit-flex;
|
|
|
|
+ display: flex;
|
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
|
+ -webkit-flex-flow: column;
|
|
|
|
+ flex-flow: column;
|
|
|
|
+ }
|
|
|
|
+ .headGN li {
|
|
|
|
+ display: none;
|
|
|
|
+ width: 3.5rem;
|
|
|
|
+ line-height: 4.1rem;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .headGN li.active {
|
|
|
|
+ display: block;
|
|
|
|
+ }
|
|
|
|
+ main{
|
|
|
|
+ background-color: #f7f7f7;
|
|
|
|
+ }
|
|
|
|
+ .inputDiv{
|
|
|
|
+ padding: 1.1rem 1.6rem;
|
|
|
|
+ position: relative;
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ display: none;
|
|
|
|
+ }
|
|
|
|
+ .inputDiv label{
|
|
|
|
+ display: block;
|
|
|
|
+ height: 3.8rem;
|
|
|
|
+ line-height: 3.8rem;
|
|
|
|
+ font-size: 1.5rem;
|
|
|
|
+ white-space: nowrap;
|
|
|
|
+ border-bottom: 1px solid #dfdfdf;
|
|
|
|
+ margin-bottom: .3rem;
|
|
|
|
+ padding-left: 1rem;
|
|
|
|
+ }
|
|
|
|
+ .inputDiv label:last-of-type{
|
|
|
|
+ border-bottom: none;
|
|
|
|
+ }
|
|
|
|
+ label>input{
|
|
|
|
+ height: 100%;
|
|
|
|
+ background-color: rgba(0,0,0,0);
|
|
|
|
+ border: none;
|
|
|
|
+ outline: none;
|
|
|
|
+ font-size: 1.3rem;
|
|
|
|
+ padding-left: 3.7rem;
|
|
|
|
+ -webkit-box-flex: 1;
|
|
|
|
+ -webkit-flex: 1;
|
|
|
|
+ flex: 1;
|
|
|
|
+ }
|
|
|
|
+ .SC{
|
|
|
|
+ width: 2.4rem;
|
|
|
|
+ height: 2.4rem;
|
|
|
|
+ background: url("../image/big_add.png") no-repeat 100%/100%;
|
|
|
|
+ -webkit-transform: translateY(.7rem);
|
|
|
|
+ transform: translateY(.7rem);
|
|
|
|
+ }
|
|
|
|
+ .TP_status,.FJ_status{
|
|
|
|
+ color: #f21;
|
|
|
|
+ font-size: 1.3rem;
|
|
|
|
+ margin-left: 2rem;
|
|
|
|
+ }
|
|
|
|
+ .banner li{
|
|
|
|
+ float: left;
|
|
|
|
+ margin-bottom: .3rem;
|
|
|
|
+ }
|
|
|
|
+ .fileDiv p{
|
|
|
|
+ font-size: 1.4rem;
|
|
|
|
+ background-color: #f8f8f8;
|
|
|
|
+ border-radius: .3rem;
|
|
|
|
+ padding: .6rem;
|
|
|
|
+ margin-bottom: .2rem;
|
|
|
|
+ }
|
|
|
|
+ #content{
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 12rem;
|
|
|
|
+ font-size: 1.3rem;
|
|
|
|
+ padding: .6rem;
|
|
|
|
+ border: 1px solid #dfdfdf;
|
|
|
|
+ resize: none;
|
|
|
|
+ border-radius: .3rem;
|
|
|
|
+ overflow-y: auto;
|
|
|
|
+ }
|
|
|
|
+ .reBtn{
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 3.5rem;
|
|
|
|
+ line-height: 3.5rem;
|
|
|
|
+ text-align: center;
|
|
|
|
+ font-size: 1.5rem;
|
|
|
|
+ color: #fff;
|
|
|
|
+ background-color: #51c4d4;
|
|
|
|
+ border-radius: 2rem;
|
|
|
|
+ margin: 1.5rem 0;
|
|
|
|
+ }
|
|
|
|
+ ::-webkit-input-placeholder{
|
|
|
|
+ color: #b4b4b4;
|
|
|
|
+ }
|
|
|
|
+ </style>
|
|
|
|
+</head>
|
|
|
|
+<body>
|
|
|
|
+<main class="flex-con">
|
|
|
|
+ <div class="inputDiv">
|
|
|
|
+ <form action="#">
|
|
|
|
+ <label class="selectFile">上传图片 <span class="TP_status"></span><i class="SC right" id="TP"></i></label>
|
|
|
|
+ <div class="banner"><ul class="clearFix"></ul></div>
|
|
|
|
+ <label class="selectFile">上传附件 <span class="FJ_status"></span><i class="SC right" id="FJ"></i></label>
|
|
|
|
+ <div class="fileDiv"><ul></ul></div>
|
|
|
|
+ <label class="title">内容</label>
|
|
|
|
+ <pre id="content" contenteditable="true"></pre>
|
|
|
|
+ </form>
|
|
|
|
+ <div class="reBtn">完成反馈</div>
|
|
|
|
+ </div>
|
|
|
|
+</main>
|
|
|
|
+<script src="../script/jquery-3.1.0.min.js"></script>
|
|
|
|
+<script src="../script/publicData.js"></script>
|
|
|
|
+<script src="../script/api.js"></script>
|
|
|
|
+<script>
|
|
|
|
+ apiready=function () {
|
|
|
|
+ if($api.getStorage("user").user_group_id==5){
|
|
|
|
+ $(".selectFile").css("display","none");
|
|
|
|
+ $(".title").text("批示内容");
|
|
|
|
+ $(".reBtn").text("确定");
|
|
|
|
+ }
|
|
|
|
+ $(".inputDiv").css("display","block");
|
|
|
|
+ var imgData=[],fileUrl=[],imgUpload=[],fileUpload=[],nowImgArr=[],nowFileArr=[],delArr=[],num=0,FKId=0,isXG=false;
|
|
|
|
+ var dialogBox = api.require('dialogBox');
|
|
|
|
+ var UIMediaScanner = api.require('UIMediaScanner');
|
|
|
|
+ var winWidth= api.winWidth/3-10;
|
|
|
|
+ var taskid=$api.getStorage("taskXQ").taskID;
|
|
|
|
+ if($api.getStorage("fkid")){
|
|
|
|
+ api.showProgress({
|
|
|
|
+ title: '努力加载中...',
|
|
|
|
+ text: '请稍等...',
|
|
|
|
+ modal: false
|
|
|
|
+ });
|
|
|
|
+ isXG=true;
|
|
|
|
+ FKId =$api.getStorage("fkid");
|
|
|
|
+ $api.setStorage("audit",FKId);
|
|
|
|
+ $api.rmStorage("fkid");
|
|
|
|
+ $.post(pageUrl+"savecontent",{task_dynamic_id:FKId},function (data) {
|
|
|
|
+ $("#content").html(toHtml(data.data["0"]['task_dynamic_content']));
|
|
|
|
+ if(data.data['photo'].length){
|
|
|
|
+ for(var i in data.data['photo']){
|
|
|
|
+ $(".banner ul").append("<li style='width:32%;height:"+winWidth+"px;margin-right: 1%'><img src='"+pageImg+"/"+data.data["photo"][i]["task_dynamic_upload_photo"]+"' style='width:100%;height:100%' /></li>");
|
|
|
|
+ nowImgArr.push(data.data["photo"][i]["task_dynamic_upload_photo"]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(data.data['attachment'].length){
|
|
|
|
+ for(var j in data.data['attachment']){
|
|
|
|
+ $(".fileDiv ul").append("<li><p>"+data.data['attachment'][j]["task_dynamic_upload_name"].replace(data.data["0"]['task_dynamic_task_id'],"").slice(10)+"</p></li>")
|
|
|
|
+ nowFileArr.push(data.data["attachment"][j]["task_dynamic_upload_photo"]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ api.hideProgress();
|
|
|
|
+ $(".reBtn").click(function () {
|
|
|
|
+ var data={
|
|
|
|
+ task_dynamic_content:$("#content").html(),
|
|
|
|
+ photolujing:imgUpload,
|
|
|
|
+ attachmentlujing:fileUpload,
|
|
|
|
+ task_id:taskid,
|
|
|
|
+ task_dynamic_id:$api.getStorage("audit"),
|
|
|
|
+ task_dynamic_upload_photo:delArr
|
|
|
|
+ }
|
|
|
|
+ if(imgData.length!=0||fileUrl.length!=0){
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: '还有文件未上传',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if(num) return;
|
|
|
|
+ num++;
|
|
|
|
+ $(".reBtn").text("正在提交...");
|
|
|
|
+ $.post(pageUrl+"savecontent1",data,function (data) {
|
|
|
|
+ if(data.status=="200"){
|
|
|
|
+ $(".reBtn").text("提交成功");
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: '修改成功,正在返回',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ $("#content").html("");
|
|
|
|
+ $(".banner").html("");
|
|
|
|
+ $(".fileDiv").html("");
|
|
|
|
+ imgData=imgUpload=fileUpload=delArr=[];
|
|
|
|
+ fileUrl="";
|
|
|
|
+ var jsfun5 = 'back();';
|
|
|
|
+ api.execScript({
|
|
|
|
+ name: 'root',
|
|
|
|
+ script: jsfun5
|
|
|
|
+ });
|
|
|
|
+ }else {
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: data.message,
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }else {
|
|
|
|
+ isXG=false;
|
|
|
|
+ $(".reBtn").click(function () {
|
|
|
|
+ var data={
|
|
|
|
+ task_dynamic_content:$("#content").html(),
|
|
|
|
+ photolujing:imgUpload,
|
|
|
|
+ attachmentlujing:fileUpload,
|
|
|
|
+ task_id:taskid
|
|
|
|
+ }
|
|
|
|
+// if(imgData.length!=0||fileUrl.length!=0){
|
|
|
|
+// api.toast({
|
|
|
|
+// msg: '还有文件未上传',
|
|
|
|
+// duration: 2000,
|
|
|
|
+// location: 'bottom'
|
|
|
|
+// });
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+ if(!data.task_dynamic_content&&data.photolujing.length==0&&data.attachmentlujing.length==0){
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: '未添加任何反馈信息',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }else {
|
|
|
|
+ if(num) return;
|
|
|
|
+ num++;
|
|
|
|
+ $(".reBtn").text("正在提交...");
|
|
|
|
+ $.post(pageUrl+"shangchuan",data,function (data) {
|
|
|
|
+ if(data.status=="200"){
|
|
|
|
+ $(".reBtn").text("提交成功");
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: '提交成功,正在返回',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ var upload = 'toFrame(5);';
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ api.execScript({
|
|
|
|
+ name: 'root',
|
|
|
|
+ script: upload
|
|
|
|
+ });
|
|
|
|
+ api.closeFrame({
|
|
|
|
+ name: 'taskFK'
|
|
|
|
+ });
|
|
|
|
+ },2000)
|
|
|
|
+ $("#content").html("");
|
|
|
|
+ $(".banner").html("");
|
|
|
|
+ $(".fileDiv").html("");
|
|
|
|
+ imgData=imgUpload=fileUpload=delArr=[];
|
|
|
|
+ fileUrl="";
|
|
|
|
+ }else {
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: data.message,
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ $(".banner").on("click",'li',function () {
|
|
|
|
+ var that=$(this)
|
|
|
|
+ popups("确认删除该图片吗?",function (ret) {
|
|
|
|
+ if (ret.eventType == 'right') {
|
|
|
|
+ var newimg=[];
|
|
|
|
+ if(isXG){
|
|
|
|
+ for(var i=0;i<nowImgArr.length;i++){
|
|
|
|
+ if(that.index()==i){
|
|
|
|
+ delArr.push(nowImgArr[i])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ for(var i=0;i<imgUpload.length;i++){
|
|
|
|
+ if(that.index()==i) continue;
|
|
|
|
+ newimg.push(imgUpload[i])
|
|
|
|
+ }
|
|
|
|
+ imgUpload=newimg;
|
|
|
|
+ }
|
|
|
|
+ that.remove();
|
|
|
|
+ dialogBox.close({
|
|
|
|
+ dialogName: 'alert'
|
|
|
|
+ });
|
|
|
|
+ }else if (ret.eventType == 'left') {
|
|
|
|
+ dialogBox.close({
|
|
|
|
+ dialogName: 'alert'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+// popups("确认删除该图片吗?",function (ret) {
|
|
|
|
+// if (ret.eventType == 'right') {
|
|
|
|
+// var newimg=[];
|
|
|
|
+// if(isXG){
|
|
|
|
+// for(var i=0;i<nowImgArr.length;i++){
|
|
|
|
+// if(that.index()==i){
|
|
|
|
+// delArr.push(nowImgArr[i])
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }else {
|
|
|
|
+// for(var i=0;i<imgData.length;i++){
|
|
|
|
+// if(that.index()==i) continue;
|
|
|
|
+// newimg.push(imgData[i])
|
|
|
|
+// }
|
|
|
|
+// imgData=newimg;
|
|
|
|
+// }
|
|
|
|
+// if(!imgData.length){
|
|
|
|
+// $(".TP_status").text(" ")
|
|
|
|
+// }
|
|
|
|
+// that.remove();
|
|
|
|
+// dialogBox.close({
|
|
|
|
+// dialogName: 'alert'
|
|
|
|
+// });
|
|
|
|
+// }else if (ret.eventType == 'left') {
|
|
|
|
+// dialogBox.close({
|
|
|
|
+// dialogName: 'alert'
|
|
|
|
+// });
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+ })
|
|
|
|
+ $(".fileDiv").on("click","p",function () {
|
|
|
|
+ var that=$(this)
|
|
|
|
+ popups("确认删除该文件吗?",function (ret) {
|
|
|
|
+ if (ret.eventType == 'right') {
|
|
|
|
+ var newfile=[];
|
|
|
|
+ if(isXG){
|
|
|
|
+ for(var i=0;i<nowFileArr.length;i++){
|
|
|
|
+ if(that.index()==i){
|
|
|
|
+ delArr.push(nowFileArr[i])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ for(var i=0;i<fileUpload.length;i++){
|
|
|
|
+ if(that.index()==i) continue;
|
|
|
|
+ newfile.push(fileUpload[i])
|
|
|
|
+ }
|
|
|
|
+ fileUpload=newfile;
|
|
|
|
+ }
|
|
|
|
+ that.remove();
|
|
|
|
+ dialogBox.close({
|
|
|
|
+ dialogName: 'alert'
|
|
|
|
+ });
|
|
|
|
+ }else if (ret.eventType == 'left') {
|
|
|
|
+ dialogBox.close({
|
|
|
|
+ dialogName: 'alert'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+// popups("确认删除该文件吗?",function (ret) {
|
|
|
|
+// if (ret.eventType == 'right') {
|
|
|
|
+// var newfile=[];
|
|
|
|
+// if(isXG){
|
|
|
|
+// for(var i=0;i<nowFileArr.length;i++){
|
|
|
|
+// if(that.index()==i){
|
|
|
|
+// delArr.push(nowFileArr[i])
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }else {
|
|
|
|
+// for(var i=0;i<fileUrl.length;i++){
|
|
|
|
+// if(that.index()==i) continue;
|
|
|
|
+// newfile.push(fileUrl[i])
|
|
|
|
+// }
|
|
|
|
+// fileUrl=newfile;
|
|
|
|
+// }
|
|
|
|
+// if(!fileUrl.length){
|
|
|
|
+// $(".FJ_status").text(" ")
|
|
|
|
+// }
|
|
|
|
+// that.remove();
|
|
|
|
+// dialogBox.close({
|
|
|
|
+// dialogName: 'alert'
|
|
|
|
+// });
|
|
|
|
+// }else if (ret.eventType == 'left') {
|
|
|
|
+// dialogBox.close({
|
|
|
|
+// dialogName: 'alert'
|
|
|
|
+// });
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+ })
|
|
|
|
+ $("#TP").click(function () {
|
|
|
|
+ api.actionSheet({
|
|
|
|
+ title: '上传图片',
|
|
|
|
+ cancelTitle: '取消',
|
|
|
|
+ buttons: ['相册', '相机']
|
|
|
|
+ }, function(ret, err) {
|
|
|
|
+ var index = ret.buttonIndex;
|
|
|
|
+ if(index==1){
|
|
|
|
+ UIMediaScanner.open({
|
|
|
|
+ type: 'picture',
|
|
|
|
+ column: 4,
|
|
|
|
+ max: 4,
|
|
|
|
+ sort: {
|
|
|
|
+ key: 'time',
|
|
|
|
+ order: 'desc'
|
|
|
|
+ },
|
|
|
|
+ texts: {
|
|
|
|
+ stateText: '已选择*项',
|
|
|
|
+ cancelText: '取消',
|
|
|
|
+ finishText: '完成'
|
|
|
|
+ },
|
|
|
|
+ styles: {
|
|
|
|
+ bg: '#fff',
|
|
|
|
+ mark: {
|
|
|
|
+ icon: '',
|
|
|
|
+ position: 'bottom_left',
|
|
|
|
+ size: 20
|
|
|
|
+ },
|
|
|
|
+ nav: {
|
|
|
|
+ bg: '#eee',
|
|
|
|
+ stateColor: '#000',
|
|
|
|
+ stateSize: 18,
|
|
|
|
+ cancelBg: 'rgba(0,0,0,0)',
|
|
|
|
+ cancelColor: '#000',
|
|
|
|
+ cancelSize: 18,
|
|
|
|
+ finishBg: 'rgba(0,0,0,0)',
|
|
|
|
+ finishColor: '#000',
|
|
|
|
+ finishSize: 18
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ exchange: true
|
|
|
|
+ }, function(ret) {
|
|
|
|
+ if (ret.eventType=="confirm") {
|
|
|
|
+ for(var i in ret.list){
|
|
|
|
+ if(api.systemType=="ios"){
|
|
|
|
+ UIMediaScanner.transPath({
|
|
|
|
+ path: ret.list[i]["path"]
|
|
|
|
+ }, function(ret, err) {
|
|
|
|
+ if (ret) {
|
|
|
|
+// $(".banner ul").append("<li style='width:32%;height:"+winWidth+"px;margin-right: 1%'><img src='file://"+ret.path+"' style='width:100%;height:100%' /></li>");
|
|
|
|
+ imgData.push("file://"+ret.path);
|
|
|
|
+ uploadImg("file://"+ret.path)
|
|
|
|
+ } else {
|
|
|
|
+ alert(JSON.stringify(err));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }else {
|
|
|
|
+// $(".banner ul").append("<li style='width:32%;height:"+winWidth+"px;margin-right: 1%'><img src='file://"+ret.list[i]["path"]+"' style='width:100%;height:100%' /></li>");
|
|
|
|
+ imgData.push("file://"+ret.list[i]["path"]);
|
|
|
|
+ uploadImg("file://"+ret.list[i]["path"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+// $(".TP_status").text("点击上传全部图片")
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }else if(index==2){
|
|
|
|
+ api.getPicture({
|
|
|
|
+ sourceType: 'camera',
|
|
|
|
+ encodingType: 'jpg',
|
|
|
|
+ mediaValue: 'pic',
|
|
|
|
+ saveToPhotoAlbum:'true',
|
|
|
|
+ destinationType: 'url',
|
|
|
|
+ quality: 50
|
|
|
|
+ }, function(ret, err) {
|
|
|
|
+ if (ret) {
|
|
|
|
+ if(!ret.data) return;
|
|
|
|
+ imgData.push("file://"+ret.data);
|
|
|
|
+// $(".TP_status").text("点击上传全部图片");
|
|
|
|
+// $(".banner ul").append("<li style='width:32%;height:"+winWidth+"px;margin-right: 1%'><img src='"+imgData[imgData.length-1]+"' style='width:100%;height:100%' /></li>");
|
|
|
|
+ uploadImg("file://"+ret.data)
|
|
|
|
+ } else {
|
|
|
|
+ alert(JSON.stringify(err));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }else {}
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ function uploadImg(url) {
|
|
|
|
+ var imageFilter = api.require('imageFilter');
|
|
|
|
+ var imageName = "rwdcimg";
|
|
|
|
+ var imageCachePath = api.cacheDir;
|
|
|
|
+ var newimg="";
|
|
|
|
+ imageFilter.compress({
|
|
|
|
+ img: url,
|
|
|
|
+ quality:0.8,
|
|
|
|
+ /* size:{
|
|
|
|
+ w:550,
|
|
|
|
+ h:480
|
|
|
|
+ },*/
|
|
|
|
+ save: {
|
|
|
|
+ album: false,
|
|
|
|
+ imgPath: imageCachePath,
|
|
|
|
+ imgName: imageName + '.jpg'
|
|
|
|
+ }
|
|
|
|
+ }, function(ret, err) {
|
|
|
|
+ var tx = imageCachePath + '/' + imageName + '.jpg';
|
|
|
|
+ $(".TP_status").text("正在上传中...");
|
|
|
|
+ api.ajax({
|
|
|
|
+ url: pageUrl+"upload",
|
|
|
|
+ method: 'post',
|
|
|
|
+ timeout: 30,
|
|
|
|
+ dataType: 'json',
|
|
|
|
+ returnAll: false,
|
|
|
|
+ data: {
|
|
|
|
+ files:{
|
|
|
|
+ "file[]":tx
|
|
|
|
+ },
|
|
|
|
+ values:{
|
|
|
|
+ task_id:taskid,
|
|
|
|
+ type:"1"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, function (ret, err) {
|
|
|
|
+ if(ret.status=="200"){
|
|
|
|
+ if(ret.message.indexOf(false)!=-1){
|
|
|
|
+ for(var i=0;i<ret.message.length;i++){
|
|
|
|
+ if(ret.message[i]!=false){
|
|
|
|
+ imgUpload.push(ret.message[i]);
|
|
|
|
+ }else {
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: "上传失败,请重试",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ for(var msgI in ret['message']){
|
|
|
|
+ imgUpload.push(ret['message'][msgI])
|
|
|
|
+ }
|
|
|
|
+ $(".banner ul").append("<li style='width:32%;height:"+winWidth+"px;margin-right: 1%'><img src='"+url+"' style='width:100%;height:100%' /></li>");
|
|
|
|
+ imgData=[];
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: "上传失败,请重试",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ $(".TP_status").text("");
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ function uploadFile(url,name) {
|
|
|
|
+ $(".FJ_status").text("正在上传中...");
|
|
|
|
+ api.ajax({
|
|
|
|
+ url: pageUrl+"upload",
|
|
|
|
+ method: 'post',
|
|
|
|
+ timeout: 30,
|
|
|
|
+ dataType: 'json',
|
|
|
|
+ returnAll: false,
|
|
|
|
+ data: {
|
|
|
|
+ "files":{
|
|
|
|
+ "file[]":url
|
|
|
|
+ },
|
|
|
|
+ "values":{
|
|
|
|
+ task_id:taskid,
|
|
|
|
+ type:"2"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, function (ret, err) {
|
|
|
|
+ if(ret.status=="200"){
|
|
|
|
+ if(ret.message.indexOf(false)!=-1){
|
|
|
|
+ for(var i=0;i<ret.message.length;i++){
|
|
|
|
+ if(ret.message[i]!=false){
|
|
|
|
+ fileUpload.push(ret.message[i]);
|
|
|
|
+ }else {
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: "上传失败,请重试",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ for(var msgI in ret['message']){
|
|
|
|
+ fileUpload.push(ret['message'][msgI])
|
|
|
|
+ }
|
|
|
|
+ $(".fileDiv ul").append("<li><p>"+name+"</p></li>");
|
|
|
|
+ fileUrl=[];
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: "上传失败,请重试",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ $(".FJ_status").text("");
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ $(".TP_status").click(function () {
|
|
|
|
+ if($(this).text()!="点击上传全部图片") return;
|
|
|
|
+ popups("确认上传吗?",function (ret) {
|
|
|
|
+ if (ret.eventType == 'right') {
|
|
|
|
+ var Data={
|
|
|
|
+ file:imgData,
|
|
|
|
+ type:"1",
|
|
|
|
+ task_id:taskid
|
|
|
|
+ }
|
|
|
|
+ $(".TP_status").text("正在上传中...");
|
|
|
|
+ api.ajax({
|
|
|
|
+ url: pageUrl+"upload",
|
|
|
|
+ method: 'post',
|
|
|
|
+ timeout: 30,
|
|
|
|
+ dataType: 'json',
|
|
|
|
+ returnAll: false,
|
|
|
|
+ data: {
|
|
|
|
+ files:{
|
|
|
|
+ "file[]":imgData
|
|
|
|
+ },
|
|
|
|
+ values:{
|
|
|
|
+ task_id:taskid,
|
|
|
|
+ type:"1"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, function (ret, err) {
|
|
|
|
+ var newImg=[];
|
|
|
|
+ if(ret.status=="200"){
|
|
|
|
+ if(ret.message.indexOf(false)!=-1){
|
|
|
|
+ for(var i=0;i<ret.message.length;i++){
|
|
|
|
+ if(ret.message[i]!=false){
|
|
|
|
+ imgUpload.push(ret.message[i]);
|
|
|
|
+ $(".banner li:eq("+i+")").remove();
|
|
|
|
+ }else {
|
|
|
|
+ newImg.push(imgData[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $(".TP_status").text("以下图片上传失败");
|
|
|
|
+ imgData=newImg;
|
|
|
|
+ }else {
|
|
|
|
+ for(var msgI in ret['message']){
|
|
|
|
+ imgUpload.push(ret['message'][msgI])
|
|
|
|
+ }
|
|
|
|
+ imgData=[];
|
|
|
|
+ $(".banner ul").html(" ");
|
|
|
|
+ $(".TP_status").text("上传成功");
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ if($(".TP_status").text()=="上传成功"){
|
|
|
|
+ $(".TP_status").text(" ");
|
|
|
|
+ }
|
|
|
|
+ },10000)
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ $(".TP_status").text("点击上传全部图片");
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: ret.message,
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ dialogBox.close({
|
|
|
|
+ dialogName: 'alert'
|
|
|
|
+ });
|
|
|
|
+ }else if (ret.eventType == 'left') {
|
|
|
|
+ dialogBox.close({
|
|
|
|
+ dialogName: 'alert'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ $("#FJ").click(function () {
|
|
|
|
+ var fileBrowser = api.require('fileBrowser');
|
|
|
|
+ fileBrowser.open(function(ret, err) {
|
|
|
|
+ if (ret) {
|
|
|
|
+ fileBrowser.close();
|
|
|
|
+ if(fileUrl.indexOf(ret.url)!=-1){
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: '已有该文件',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ var url11 = ret.url;
|
|
|
|
+ var i = url11.lastIndexOf('/');
|
|
|
|
+ var j = url11.length;
|
|
|
|
+ var name11 = url11.slice(i+1,j);
|
|
|
|
+// $(".fileDiv ul").append("<li><p>"+name11+"</p></li>")
|
|
|
|
+// $(".FJ_status").text("点击上传全部附件");
|
|
|
|
+ uploadFile(url11,name11);
|
|
|
|
+ fileUrl.push(ret.url);
|
|
|
|
+ } else {
|
|
|
|
+ alert(JSON.stringify(err));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ $(".FJ_status").click(function () {
|
|
|
|
+ if($(this).text()!="点击上传全部附件") return;
|
|
|
|
+ popups("确认上传吗?",function (ret) {
|
|
|
|
+ if (ret.eventType == 'right') {
|
|
|
|
+ var Data={
|
|
|
|
+ file:fileUrl
|
|
|
|
+ }
|
|
|
|
+ $(".FJ_status").text("正在上传中...");
|
|
|
|
+ api.ajax({
|
|
|
|
+ url: pageUrl+"upload",
|
|
|
|
+ method: 'post',
|
|
|
|
+ timeout: 30,
|
|
|
|
+ dataType: 'json',
|
|
|
|
+ returnAll: false,
|
|
|
|
+ data: {
|
|
|
|
+ "files":{
|
|
|
|
+ "file[]":fileUrl
|
|
|
|
+ },
|
|
|
|
+ "values":{
|
|
|
|
+ task_id:taskid,
|
|
|
|
+ type:"2"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, function (ret, err) {
|
|
|
|
+ var newFile=[];
|
|
|
|
+ if(ret.status=="200"){
|
|
|
|
+ if(ret.message.indexOf(false)!=-1){
|
|
|
|
+ for(var i=0;i<ret.message.length;i++){
|
|
|
|
+ if(ret.message[i]!=false){
|
|
|
|
+ fileUpload.push(ret.message[i]);
|
|
|
|
+ $(".fileDiv li:eq("+i+")").remove();
|
|
|
|
+ }else {
|
|
|
|
+ newFile.push(fileUrl[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $(".FJ_status").text("以下附件上传失败");
|
|
|
|
+ fileUrl=newFile;
|
|
|
|
+ }else {
|
|
|
|
+ for(var msgI in ret['message']){
|
|
|
|
+ fileUpload.push(ret['message'][msgI])
|
|
|
|
+ }
|
|
|
|
+ fileUrl=[];
|
|
|
|
+ $(".fileDiv ul").html(" ");
|
|
|
|
+ $(".FJ_status").text("上传成功");
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ if($(".FJ_status").text()=="上传成功"){
|
|
|
|
+ $(".FJ_status").text(" ");
|
|
|
|
+ }
|
|
|
|
+ },10000)
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ $(".FJ_status").text("点击上传全部附件");
|
|
|
|
+ api.toast({
|
|
|
|
+ msg: ret.message,
|
|
|
|
+ duration: 2000,
|
|
|
|
+ location: 'bottom'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ dialogBox.close({
|
|
|
|
+ dialogName: 'alert'
|
|
|
|
+ });
|
|
|
|
+ }else if (ret.eventType == 'left') {
|
|
|
|
+ dialogBox.close({
|
|
|
|
+ dialogName: 'alert'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+ $("#backBtn").click(function () {
|
|
|
|
+ api.closeWin();
|
|
|
|
+ })
|
|
|
|
+ function toHtml(str) {
|
|
|
|
+ var a="<",b=">",c=" ",d="&nbsp;",text=str;
|
|
|
|
+ if(text.match(a)) {
|
|
|
|
+ toChange(a,"<")
|
|
|
|
+ }
|
|
|
|
+ if(text.match(b)) {
|
|
|
|
+ toChange(b,">")
|
|
|
|
+ }
|
|
|
|
+ if(text.match(c)) {
|
|
|
|
+ toChange(c," ")
|
|
|
|
+ }
|
|
|
|
+ if(text.match(d)) {
|
|
|
|
+ toChange(d," ")
|
|
|
|
+ }
|
|
|
|
+ function toChange(type,type1) {
|
|
|
|
+ text=text.replace(type,type1);
|
|
|
|
+ if(text.match(type)) {
|
|
|
|
+ toChange(type,type1)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return text;
|
|
|
|
+ }
|
|
|
|
+ function popups(val,fn) {
|
|
|
|
+ dialogBox.alert({
|
|
|
|
+ texts: {
|
|
|
|
+ title: '确认',
|
|
|
|
+ content: val,
|
|
|
|
+ leftBtnTitle: '取消',
|
|
|
|
+ rightBtnTitle: '确认'
|
|
|
|
+ },
|
|
|
|
+ styles: {
|
|
|
|
+ bg: '#fff',
|
|
|
|
+ w: 300,
|
|
|
|
+ title: {
|
|
|
|
+ marginT: 20,
|
|
|
|
+ icon: 'widget://res/gou.png',
|
|
|
|
+ iconSize: 40,
|
|
|
|
+ titleSize: 13,
|
|
|
|
+ titleColor: '#000'
|
|
|
|
+ },
|
|
|
|
+ content: {
|
|
|
|
+ color: '#000',
|
|
|
|
+ size: 16
|
|
|
|
+ },
|
|
|
|
+ left: {
|
|
|
|
+ marginB: 0,
|
|
|
|
+ marginL: 0,
|
|
|
|
+ w: 150,
|
|
|
|
+ h: 60,
|
|
|
|
+ corner: 2,
|
|
|
|
+ bg: '#f9f9f9',
|
|
|
|
+ color: '#818181',
|
|
|
|
+ size: 12
|
|
|
|
+ },
|
|
|
|
+ right: {
|
|
|
|
+ marginB: 0,
|
|
|
|
+ marginL: 0,
|
|
|
|
+ w: 150,
|
|
|
|
+ h:60,
|
|
|
|
+ corner: 2,
|
|
|
|
+ bg: '#51c4d4',
|
|
|
|
+ color: '#fff',
|
|
|
|
+ size: 12
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, function(ret) {
|
|
|
|
+ fn(ret)
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+</body>
|
|
|
|
+</html>
|