Browse Source

bugfix

pull/3571/head
timlai 3 years ago
parent
commit
790579608d
  1. 5
      src/SSCMS.Web/Pages/ss-admin/settings/cloudTickets.cshtml
  2. 5
      src/SSCMS.Web/wwwroot/sitefiles/assets/js/admin/settings/cloudDashboard.js
  3. 87
      src/SSCMS.Web/wwwroot/sitefiles/assets/js/admin/settings/cloudTicketMessages.js
  4. 56
      src/SSCMS.Web/wwwroot/sitefiles/assets/js/admin/settings/cloudTickets.js

5
src/SSCMS.Web/Pages/ss-admin/settings/cloudTickets.cshtml

@ -20,6 +20,9 @@
:value="status"></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单编号">
<el-input v-model="formInline.ticketNo" placeholder="工单编号"></el-input>
</el-form-item>
<el-form-item label="关键字">
<el-input v-model="formInline.keyword" placeholder="关键字"></el-input>
</el-form-item>
@ -112,7 +115,7 @@
</el-form>
<el-divider></el-divider>
<div class="drawer__footer">
<el-button type="primary" v-on:click="btnSubmitClick" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}
<el-button type="primary" v-on:click="btnSubmitClick" :loading="submitting">{{ submitting ? '提交中 ...' : '确 定' }}
</el-button>
<el-button v-on:click="btnCancelClick">取 消</el-button>
</div>

5
src/SSCMS.Web/wwwroot/sitefiles/assets/js/admin/settings/cloudDashboard.js

@ -179,7 +179,10 @@ var methods = {
},
btnTicketClick: function () {
window.open('https://sscms.com/home/#/my/tickets');
utils.addTab('工单技术支持', utils.getSettingsUrl('cloudTickets', {
isAdd: true,
tabName: utils.getTabName()
}));
},
btnDocsClick: function () {

87
src/SSCMS.Web/wwwroot/sitefiles/assets/js/admin/settings/cloudTicketMessages.js

@ -1,5 +1,6 @@
var $urlCloud = "home/my/ticketMessages";
var $urlCloudUpload = 'home/my/ticketMessages/actions/upload';
var $urlCloudClose = 'home/my/ticketMessages/actions/close';
var data = utils.init({
ticketNo: utils.getQueryString('ticketNo'),
@ -48,29 +49,48 @@ var methods = {
},
apiClose: function() {
api.close(
{
ticketNo: this.ticket.ticketNo,
},
(res) => {
if (!res.value) return;
utils.success('工单关闭成功!');
this.ticket.status = 'Closed';
},
);
var $this = this;
utils.loading(this, true);
cloud.post($urlCloudClose, {
ticketNo: this.ticket.ticketNo,
})
.then(function (response) {
var res = response.data;
utils.success('工单关闭成功!');
$this.ticket.status = 'Closed';
})
.catch(function (error) {
utils.error(error);
})
.then(function () {
utils.loading($this, false);
});
},
apiSubmit: function(messageType, storageKey, content) {
var req = {
var $this = this;
utils.loading(this, true);
cloud.post($urlCloud, {
ticketNo: this.ticket.ticketNo,
messageType,
storageKey,
content,
};
api.submit(req, (res) => {
this.form.content = '';
this.ticket.status = 'Dealing';
this.messages.push(res.message);
messageType: messageType,
storageKey: storageKey,
content: content,
})
.then(function (response) {
var res = response.data;
$this.form.content = '';
$this.ticket.status = 'Dealing';
$this.messages.push(res.message);
})
.catch(function (error) {
utils.error(error);
})
.then(function () {
utils.loading($this, false);
});
},
@ -109,16 +129,15 @@ var methods = {
},
btnCloseClick: function() {
utils.alertDelete(
{
title: '关闭工单',
text: '此操作将关闭工单,确定吗?',
button: '确认关闭',
},
() => {
this.apiClose();
},
);
var $this = this;
utils.alertDelete({
title: '关闭工单',
text: '此操作将关闭工单,确定吗?',
button: '确认关闭',
callback: function() {
$this.apiClose();
}
});
},
btnSubmitClick: function() {
@ -128,7 +147,7 @@ var methods = {
},
uploadBefore: function(file) {
const isLt10M = file.size / 1024 / 1024 < 10;
var isLt10M = file.size / 1024 / 1024 < 10;
if (!isLt10M) {
utils.error('文件大小不能超过 10MB!');
}
@ -145,14 +164,11 @@ var methods = {
uploadError: function(err) {
utils.loading(false);
const error = JSON.parse(err.message);
var error = JSON.parse(err.message);
utils.error(error.message);
},
getClassName: function(message) {
if (this.isReply) {
return message.isReply ? 'message-item--right' : 'message-item--left';
}
return message.isReply ? 'message-item--left' : 'message-item--right';
},
@ -165,7 +181,7 @@ var methods = {
},
getStorageUrl: function(message) {
return cloud.hostStorage + message.storageKey;
return cloud.hostStorage + '/' + message.storageKey;
},
getAvatarUrl: function() {
@ -189,5 +205,6 @@ var $vue = new Vue({
cloud.checkAuth(function () {
$this.apiGet();
});
utils.keyPress(this.btnSubmitClick);
},
});

56
src/SSCMS.Web/wwwroot/sitefiles/assets/js/admin/settings/cloudTickets.js

@ -3,15 +3,16 @@ var $urlCloudUpload = 'home/my/tickets/actions/upload';
var data = utils.init({
isTicket: false,
isAdd: false,
cloudType: '',
isAdd: utils.getQueryBoolean('isAdd'),
count: 0,
tickets: [],
isMessages: false,
messagesCount: 0,
messages: [],
isAdd: false,
formInline: {
status: 'All',
ticketNo: '',
keyword: '',
currentPage: 1,
offset: 0,
@ -23,7 +24,7 @@ var data = utils.init({
content: '',
fileUrls: [],
},
loading: false,
submitting: false,
uploadToken: '',
uploadUrl: '',
fileList: [],
@ -34,23 +35,20 @@ var methods = {
var $this = this;
utils.loading(this, true);
cloud
.get($urlCloud, {
cloud.get($urlCloud, {
params: this.formInline,
})
.then(function (response) {
}).then(function (response) {
var res = response.data;
$this.isTicket = res.isTicket;
$this.cloudType = res.cloudType;
$this.count = res.count;
$this.tickets = res.tickets;
$this.uploadToken = $cloudToken;
$this.uploadUrl = cloud.defaults.baseURL + '/' + $urlCloudUpload;
})
.catch(function (error) {
}).catch(function (error) {
utils.error(error);
})
.then(function () {
}).then(function () {
utils.loading($this, false);
});
},
@ -58,20 +56,17 @@ var methods = {
apiSubmit: function() {
var $this = this;
cloud.post($urlCloud, this.form)
.then(function (response) {
cloud.post($urlCloud, this.form).then(function (response) {
var res = response.data;
if (!res.value) return;
utils.success('工单提交成功!');
$this.apiGet();
$this.isAdd = false;
})
.catch(function (error) {
$this.apiGet();
}).catch(function (error) {
utils.error(error);
})
.then(function () {
$this.loading = false;
}).then(function () {
$this.submitting = false;
});
},
@ -105,11 +100,11 @@ var methods = {
return '普通工单';
},
getTicketCategory: function(category) {
if (category === 'Cms') return 'CMS问题';
if (category === 'Cloud') return '网站云问题';
if (category === 'Theme') return '模板问题';
if (category === 'Extension') return '插件问题';
getTicketCategory: function(ticket) {
if (ticket.category === 'Cms') return 'CMS问题';
if (ticket.category === 'Cloud') return '网站云问题';
if (ticket.category === 'Theme') return '模板问题';
if (ticket.category === 'Extension') return '插件问题';
return '其他';
},
@ -132,12 +127,12 @@ var methods = {
},
btnAddClick: function() {
if (this.isTicket) {
if (this.isTicket && this.cloudType !== 'Free') {
this.isAdd = true;
} else {
alert({
title: '提交工单',
text: '系统检测到您的云助手版本为免费版,暂无法提交工单!',
text: '系统检测到您的云助手版本为免费版,使用工单请升级云助手版本!',
type: 'warning',
confirmButtonText: '关 闭',
showConfirmButton: true,
@ -189,9 +184,9 @@ var methods = {
var $this = this;
this.$refs.form.validate(function(valid) {
if (valid) {
$this.loading = true;
$this.submitting = true;
$this.form.fileUrls = [];
for (const file of $this.fileList) {
for (var file of $this.fileList) {
$this.form.fileUrls.push(file.url);
}
$this.apiSubmit();
@ -213,5 +208,10 @@ var $vue = new Vue({
cloud.checkAuth(function () {
$this.apiGet();
});
utils.keyPress(function() {
if ($this.isTicket && $this.isAdd) {
$this.btnSubmitClick();
}
});
},
});
Loading…
Cancel
Save