Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
html
/
h5wandahuijia
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7e131677
authored
Feb 13, 2019
by
mamingqun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加了修改dest脚本,上传图片修改
parent
77430af8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
56 deletions
+135
-56
src/pages/index/ImgUp.vue
+69
-54
src/pages/index/index.js
+2
-2
tools.js
+61
-0
修改dist.bat
+3
-0
No files found.
src/pages/index/ImgUp.vue
View file @
7e131677
...
...
@@ -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,22 +194,22 @@ 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);
var
year
=
myDate
.
getFullYear
()
+
'年'
;
var
month
=
myDate
.
getMonth
()
+
1
+
'月'
;
var
date
=
myDate
.
getDate
()
+
'日'
;
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('上传成功');
// 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
});
});
}
});
//
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);
//
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
//
});
//
});
//
}
//
});
}
});
});
...
...
@@ -399,7 +393,7 @@ export default {
// console.log(typeof time);
// console.log(time);
// console.log(time['Date']);
if
(
this
.
fabuLock
)
{
this
.
fabuLock
=
false
;
setTimeout
(()
=>
{
...
...
@@ -426,7 +420,7 @@ export default {
});
return
;
}
// if (!this.image_address.trim()) {
// Toast({
// message: '请输入作品的拍摄地'
...
...
@@ -454,7 +448,7 @@ export default {
.
then
(
res
=>
{
console
.
log
(
'发布的res'
);
console
.
log
(
res
);
if
(
res
.
data
.
code
===
0
)
{
Toast
({
message
:
'发布成功'
...
...
@@ -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,15 +606,15 @@ body {
right
:
0
;
bottom
:
0
;
.pictureTime{
.pictureTime
{
background
:
#f5f5f5
;
font-size
:
30px
;
height
:
50px
;
line-height
:
50px
;
padding-left
:
10px
;
padding-right
:
10px
;
.time{
.time
{
float
:
right
;
}
}
...
...
src/pages/index/index.js
View file @
7e131677
...
...
@@ -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
();
...
...
tools.js
0 → 100644
View file @
7e131677
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
);
}
})
}
})
}
修改dist.bat
0 → 100644
View file @
7e131677
node ./tools.js
node ./tools.js
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment