问题描述:
知识付费后台公众号关注回复添加图片异常问题。
解决办法:
- 文件路径 application/admin/view/wechat/reply/index.php ,找到uploadImg、uploadMusic、mounted方法,对照下面代码修改。
methods:
uploadImg: function () {
var vm = this;
this.uploadLink = "{:Url('upload_img')}";
this.uploadColl = function(pic){
vm.dataGroup.image.src = pic;
};
this.uploadInst.reload({
url: this.uploadLink,
accept: 'images'
});
$('#file').trigger('click');
}
……
uploadMusic:function(){
var vm = this;
this.uploadLink = "{:Url('upload_file')}";
this.uploadColl = function(pic){
vm.dataGroup.voice.src = pic;
};
this.uploadInst.reload({
url: this.uploadLink,
accept: 'audio'
});
$('#file').trigger('click');
}
mounted: function () {
window.vm = this;
this.key = "{$key}"
this.msg = "{$title}";
res= {$replay_arr};
window.vm.type = res.type;
window.vm.status = res.status;
if(res.type == 'image') {
window.vm.dataGroup.image.src = res.data.src;
}else if(res.type == 'text'){
window.vm.dataGroup.text.content = res.data.content;
}else if(res.type == 'voice'){
window.vm.dataGroup.voice.src = res.data.src;
}else if(res.type == 'news'){
window.vm.dataGroup.news = res.data;
}
if(window.vm.used_key){
window.vm.keyword = res.key;
}
this.$nextTick(function() {
var that = this;
var upload = layui.upload;
var uploadInst = upload.render({
elem: '#file',
data: {
file: 'file'
},
done: function(res) {
if (res.code == 200) {
$eb.message('success', res.msg);
that.uploadColl && that.uploadColl(res.data);
} else {
$eb.message('error', res.msg);
}
},
error: function() {
$eb.message('error', '请求出现异常');
}
});
that.uploadInst = uploadInst;
});
}
- 文件路径 application\admin\view\wechat\reply\add_keyword.php ,找到uploadImg、uploadMusic、mounted方法,对照下面代码修改。
uploadImg: function () {
var vm = this;
this.uploadLink = "{:Url('upload_img')}";
this.uploadColl = function(pic){
vm.dataGroup.image.src = pic;
};
this.uploadInst.reload({
url: this.uploadLink,
accept: 'images'
});
$('#file').trigger('click');
}
……
uploadMusic:function(){
var vm = this;
this.uploadLink = "{:Url('upload_file')}";
this.uploadColl = function(pic){
vm.dataGroup.voice.src = pic;
};
this.uploadInst.reload({
url: this.uploadLink,
accept: 'audio'
});
$('#file').trigger('click');
}
mounted: function () {
window.vm = this;
this.used_key = "{$key}";
res= {$replay_arr};
if(res.id > 0){
window.vm.type = res.type;
window.vm.status = res.status;
if(res.type == 'image') {
window.vm.dataGroup.image.src = res.data.src;
}else if(res.type == 'text'){
window.vm.dataGroup.text.content = res.data.content;
}else if(res.type == 'voice'){
window.vm.dataGroup.voice.src = res.data.src;
}else if(res.type == 'news'){
window.vm.dataGroup.news = res.data;
}
if(window.vm.used_key){
window.vm.keyword = res.key;
}
}
this.$nextTick(function() {
var that = this;
var upload = layui.upload;
var uploadInst = upload.render({
elem: '#file',
data: {
file: 'file'
},
done: function(res) {
if (res.code == 200) {
$eb.message('success', res.msg);
that.uploadColl && that.uploadColl(res.data);
} else {
$eb.message('error', res.msg);
}
},
error: function() {
$eb.message('error', '请求出现异常');
}
});
that.uploadInst = uploadInst;
});
}
- 修改完后清除缓存。
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}