Commit 7e131677 by mamingqun

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

parent 77430af8
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
:rows="2" :rows="2"
></x-textarea> ></x-textarea>
</group> </group>
</div> --> </div>-->
<!-- <div class="pictureTime marginTop30"> <!-- <div class="pictureTime marginTop30">
<div @click="openPicker" class="pictureTime"><span>拍摄时间</span> <span class='time'>{{pictureTime}}</span></div> <div @click="openPicker" class="pictureTime"><span>拍摄时间</span> <span class='time'>{{pictureTime}}</span></div>
<DatetimePicker <DatetimePicker
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
date-format="{value}" date-format="{value}"
hourFormat="{value}" hourFormat="{value}"
></DatetimePicker> ></DatetimePicker>
</div> --> </div>-->
<div class="fabu" @click="fabu"> <div class="fabu" @click="fabu">
<a href="#">发布作品</a> <a href="#">发布作品</a>
</div> </div>
...@@ -194,22 +194,22 @@ export default { ...@@ -194,22 +194,22 @@ export default {
image_time: '' image_time: ''
}; };
}, },
computed:{ computed: {
pictureTime(){ pictureTime() {
if (this.image_time) { if (this.image_time) {
// console.log(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); // console.log(myDate);
var year = myDate.getFullYear() + '年'; var year = myDate.getFullYear() + '年';
var month = myDate.getMonth() + 1 + '月'; var month = myDate.getMonth() + 1 + '月';
var date = myDate.getDate() + '日'; var date = myDate.getDate() + '日';
var hour = myDate.getHours() + '时'; var hour = myDate.getHours() + '时';
return year + month + date + hour; return year + month + date + hour;
}else{ } else {
} }
...@@ -284,47 +284,41 @@ export default { ...@@ -284,47 +284,41 @@ export default {
vm.isPhoto = false; vm.isPhoto = false;
vm.isPreivw = true; vm.isPreivw = true;
// console.log('vm.testUrl', vm.testUrl); vm.uploadPicture();
// console.log('vm.base64', vm.base64);
// console.log('imgUrls', vm.imgUrls);
// console.log('isIos', vm.isIos);
// console.log('isPreivw', vm.isPreivw);
// vm.upImg();
} }
}); });
wx.uploadImage({ // wx.uploadImage({
localId: vm.imgUrls[0], // 需要上传的图片的本地ID,由chooseImage接口获得 // localId: vm.imgUrls[0], // 需要上传的图片的本地ID,由chooseImage接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示 // isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) { // success: function (res) {
var serverId = res.serverId; // 返回图片的服务器端ID // var serverId = res.serverId; // 返回图片的服务器端ID
// console.log('上传成功'); // // console.log('上传成功');
// console.log(res); // // console.log(res);
axios // axios
.get('/contest/wx/upload', { // .get('/contest/wx/upload', {
params: { media_id: serverId } // params: { media_id: serverId }
}) // })
.then(res => { // .then(res => {
console.log('发给服务serverid'); // console.log('发给服务serverid');
console.log(res); // console.log(res);
if (res.data.code === 0) { // if (res.data.code === 0) {
vm.small_image = // vm.small_image =
res.data.data.small_image; // res.data.data.small_image;
vm.big_image = // vm.big_image =
res.data.data.big_image; // res.data.data.big_image;
} // }
}) // })
.catch(error => { // .catch(error => {
console.log('发给服务serverid的错误'); // console.log('发给服务serverid的错误');
console.log(error); // console.log(error);
Toast({ // Toast({
message: error.response.data.msg // message: error.response.data.msg
}); // });
}); // });
} // }
}); // });
} }
}); });
}); });
...@@ -399,7 +393,7 @@ export default { ...@@ -399,7 +393,7 @@ export default {
// console.log(typeof time); // console.log(typeof time);
// console.log(time); // console.log(time);
// console.log(time['Date']); // console.log(time['Date']);
if (this.fabuLock) { if (this.fabuLock) {
this.fabuLock = false; this.fabuLock = false;
setTimeout(() => { setTimeout(() => {
...@@ -426,7 +420,7 @@ export default { ...@@ -426,7 +420,7 @@ export default {
}); });
return; return;
} }
// if (!this.image_address.trim()) { // if (!this.image_address.trim()) {
// Toast({ // Toast({
// message: '请输入作品的拍摄地' // message: '请输入作品的拍摄地'
...@@ -454,7 +448,7 @@ export default { ...@@ -454,7 +448,7 @@ export default {
.then(res => { .then(res => {
console.log('发布的res'); console.log('发布的res');
console.log(res); console.log(res);
if (res.data.code === 0) { if (res.data.code === 0) {
Toast({ Toast({
message: '发布成功' message: '发布成功'
...@@ -537,11 +531,32 @@ export default { ...@@ -537,11 +531,32 @@ export default {
openPicker() { openPicker() {
this.$refs.picker.open(); this.$refs.picker.open();
}, },
preventPickerDefaultIOs(){ preventPickerDefaultIOs() {
document.getElementsByClassName('mint-datetime')[0].addEventListener('touchmove',function (e) { document.getElementsByClassName('mint-datetime')[0].addEventListener('touchmove', function (e) {
// console.log(123); // console.log(123);
e.preventDefault(); 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: { components: {
...@@ -591,15 +606,15 @@ body { ...@@ -591,15 +606,15 @@ body {
right: 0; right: 0;
bottom: 0; bottom: 0;
.pictureTime{ .pictureTime {
background: #f5f5f5; background: #f5f5f5;
font-size: 30px; font-size: 30px;
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
.time{ .time {
float: right; float: right;
} }
} }
......
...@@ -23,8 +23,8 @@ import fastclick from 'fastclick' ...@@ -23,8 +23,8 @@ import fastclick from 'fastclick'
fastclick.attach(document.body) fastclick.attach(document.body)
// import VConsole from 'vconsole'; import VConsole from 'vconsole';
// var vConsole = new VConsole(); var vConsole = new VConsole();
window.$eventbus = new Vue(); 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