Skip to content

Commit

Permalink
optimize: 发布图片时,还有图片没有上传成功时,点击发布,需要修改一下提示语 #804
Browse files Browse the repository at this point in the history
  • Loading branch information
boxshadow committed Aug 29, 2019
1 parent c52634e commit 0d88593
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions packages/zhiyicx-plus-pc/resources/assets/web/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var loadHtml = '<div class=\'loading\'><img src=\'' + TS.RESOURCE_URL +
'/images/three-dots.svg\' class=\'load\'></div>'
var confirmTxt = '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-warning"></use></svg> '
var initNums = 255
var uploadedTask = 0;
var buyTSInfo = '开源版无此功能,需要使用此功能,请购买正版授权源码,详情访问www.thinksns.com,也可直接咨询:QQ3515923610;电话:17311245680。'

axios.defaults.baseURL = TS.SITE_URL
Expand Down Expand Up @@ -177,11 +178,14 @@ var fileUpload = {
var reader = new FileReader()
reader.onload = function (e) {
var hash = md5(e.target.result)
uploadedTask++
axios.get('/api/v2/files/uploaded/' + hash)
.then(function (response) {
uploadedTask--
if (response.data.id > 0) callback(image, f, response.data.id)
})
.catch(function (error) {
uploadedTask--
error.response.status === 404 && _this.uploadFile(image, f, callback)
})
}
Expand All @@ -190,11 +194,14 @@ var fileUpload = {
uploadFile: function (image, f, callback) {
var formDatas = new FormData()
formDatas.append('file', f)
uploadedTask++
axios.post('/api/v2/files', formDatas)
.then(function (response) {
uploadedTask--
if (response.data.id > 0) callback(image, f, response.data.id)
})
.catch(function (error) {
uploadedTask--
showError(error.response)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
uploadManager._getFileList().show();

if ($('.uploadify-queue-add').length == 0) {
// 图片添加那妞
// 图片添加按钮
var add = '<a class="feed_picture_span uploadify-queue-add"></a>'
$('.uploadify-queue').append(add);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import upload from '../../../../../../resources/spa/src/api/upload'

var weibo = {};

/**
Expand All @@ -21,7 +23,7 @@ weibo.afterUpload = function(image, f, task_id) {
weibo.postFeed = function() {
// 登录判断
checkLogin();

if (uploadedTask > 0) return;
// 付费免费
var select = $('#feed_select').data('value');
if (select == 'pay') {
Expand Down
4 changes: 2 additions & 2 deletions packages/zhiyicx-plus-pc/src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

use Auth;
use Session;
//use HTMLPurifier;
use HTMLPurifier;
use Carbon\Carbon;
use GuzzleHttp\Client;
//use HTMLPurifier_Config;
use HTMLPurifier_Config;
use Zhiyi\Plus\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
Expand Down

0 comments on commit 0d88593

Please sign in to comment.