Commit 7e131677 by mamingqun

添加了修改dest脚本,上传图片修改

parent 77430af8
......@@ -138,7 +138,7 @@
:rows="2"
></x-textarea>
</group>
</div> -->
</div>-->
<!-- <div class="pictureTime marginTop30">
<div @click="openPicker" class="pictureTime"><span>拍摄时间</span> <span class='time'>{{pictureTime}}</span></div>
<DatetimePicker
......@@ -150,7 +150,7 @@
date-format="{value}"
hourFormat="{value}"
></DatetimePicker>
</div> -->
</div>-->
<div class="fabu" @click="fabu">
<a href="#">发布作品</a>
</div>
......@@ -194,12 +194,12 @@ export default {
image_time: ''
};
},
computed:{
pictureTime(){
computed: {
pictureTime() {
if (this.image_time) {
// console.log(this.image_time);
var myDate= new Date(this.image_time);
var myDate = new Date(this.image_time);
// console.log(myDate);
......@@ -209,7 +209,7 @@ export default {
var hour = myDate.getHours() + '时';
return year + month + date + hour;
}else{
} else {
}
......@@ -284,47 +284,41 @@ export default {
vm.isPhoto = false;
vm.isPreivw = true;
// console.log('vm.testUrl', vm.testUrl);
// console.log('vm.base64', vm.base64);
// console.log('imgUrls', vm.imgUrls);
// console.log('isIos', vm.isIos);
// console.log('isPreivw', vm.isPreivw);
// vm.upImg();
vm.uploadPicture();
}
});
wx.uploadImage({
localId: vm.imgUrls[0], // 需要上传的图片的本地ID,由chooseImage接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) {
var serverId = res.serverId; // 返回图片的服务器端ID
// console.log('上传成功');
// wx.uploadImage({
// localId: vm.imgUrls[0], // 需要上传的图片的本地ID,由chooseImage接口获得
// isShowProgressTips: 1, // 默认为1,显示进度提示
// success: function (res) {
// var serverId = res.serverId; // 返回图片的服务器端ID
// // console.log('上传成功');
// // console.log(res);
// axios
// .get('/contest/wx/upload', {
// params: { media_id: serverId }
// })
// .then(res => {
// console.log('发给服务serverid');
// console.log(res);
axios
.get('/contest/wx/upload', {
params: { media_id: serverId }
})
.then(res => {
console.log('发给服务serverid');
console.log(res);
if (res.data.code === 0) {
vm.small_image =
res.data.data.small_image;
vm.big_image =
res.data.data.big_image;
}
})
.catch(error => {
console.log('发给服务serverid的错误');
console.log(error);
Toast({
message: error.response.data.msg
});
});
}
});
// if (res.data.code === 0) {
// vm.small_image =
// res.data.data.small_image;
// vm.big_image =
// res.data.data.big_image;
// }
// })
// .catch(error => {
// console.log('发给服务serverid的错误');
// console.log(error);
// Toast({
// message: error.response.data.msg
// });
// });
// }
// });
}
});
});
......@@ -537,11 +531,32 @@ export default {
openPicker() {
this.$refs.picker.open();
},
preventPickerDefaultIOs(){
document.getElementsByClassName('mint-datetime')[0].addEventListener('touchmove',function (e) {
preventPickerDefaultIOs() {
document.getElementsByClassName('mint-datetime')[0].addEventListener('touchmove', function (e) {
// console.log(123);
e.preventDefault();
})
},
uploadPicture() {
axios.post('/contest/base/upload', {
content: this.base64[0]
}).then(res => {
console.log('发给服务serverid');
console.log(res);
if (res.data.code === 0) {
vm.small_image =
res.data.data.small_image;
vm.big_image =
res.data.data.big_image;
}
})
.catch(error => {
console.log('发给服务serverid的错误');
console.log(error);
Toast({
message: error.response.data.msg
});
});
}
},
components: {
......@@ -591,7 +606,7 @@ body {
right: 0;
bottom: 0;
.pictureTime{
.pictureTime {
background: #f5f5f5;
font-size: 30px;
height: 50px;
......@@ -599,7 +614,7 @@ body {
padding-left: 10px;
padding-right: 10px;
.time{
.time {
float: right;
}
}
......
......@@ -23,8 +23,8 @@ import fastclick from 'fastclick'
fastclick.attach(document.body)
// import VConsole from 'vconsole';
// var vConsole = new VConsole();
import VConsole from 'vconsole';
var vConsole = new VConsole();
window.$eventbus = new Vue();
......
var fs = require('fs');
var path = require('path');
// index.blade.php
// user.blade.php
var indexPhp = path.resolve(__dirname, './dist/index.blade.php');
var indexHtml = path.resolve(__dirname, './dist/index.html');
var userPhp = path.resolve(__dirname, './dist/user.blade.php');
var userHtml = path.resolve(__dirname, './dist/user.html');
fs.stat(path.resolve(__dirname, './dist/index.blade.php'), function (err) {
if (err) {
// console.log(err);
rename(indexPhp,indexHtml);
rename(userPhp,userHtml);
} else {
deleteFile(indexPhp,indexHtml);
deleteFile(userPhp,userHtml);
}
})
function deleteFile(php,html) {
fs.unlink(php,function (err) {
if (err) {
console.log(err);
}else{
rename(php,html);
}
});
}
function rename(php,html) {
fs.rename(html,php,function (err) {
if (err) {
console.log(err);
}else{
if(php.includes('user')){
// console.log(php);
changeUserFile()
}
}
})
}
function changeUserFile() {
fs.readFile(userPhp,'utf-8',function (err,data) {
if (err) {
console.log(err);
}else{
var str = data.replace(/\.\/static/g,'../static');
fs.writeFile(userPhp,str,function (err) {
if (err) {
console.log(err);
}
})
}
})
}
node ./tools.js
node ./tools.js
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment