Commit c5136c6e authored by 潘永坪's avatar 潘永坪

图片bug修复

parent be0bb45d
......@@ -34,8 +34,8 @@
},
onReady() {},
onLoad() {
this.$request("distribution/vlog/getVlogCreateInfo", {//获取结果
userId: uni.getStorageSync("openid")
this.$request('distribution/vlog/getVlogCreateInfo', {//获取结果
userId: uni.getStorageSync('openid')
}).then(res=>{
setTimeout(()=>{
this.getMyVlogList()
......@@ -44,15 +44,15 @@
},
methods: {
navTo(item){
this.$u.route('/pages/vlog/vlogList/vlogList?merchantId='+item.merchantId);
this.$u.route('/pages/vlog/vlogList/vlogList?merchantId='+item.merchantId)
},
getMyVlogList(){
this.$request("wechatUser/myPage/getVlogRecord", {
openid: uni.getStorageSync("openid"),
this.$request('wechatUser/myPage/getVlogRecord', {
openid: uni.getStorageSync('openid'),
productType:0
}).then(res => {
this.show = false
if(res.code==="00"){
if(res.code==='00'){
this.vlogList = res.data
if (this.vlogList.length > 0) { //如果有数据
uni.setNavigationBarColor({ //动态更改导航条颜色
......@@ -64,8 +64,8 @@
}
})
uni.setBackgroundColor({
backgroundColor: "#192033"
});
backgroundColor: '#192033'
})
} else { //数据为空
this.show = false
}
......
......@@ -24,7 +24,7 @@
data() {
return {
list: [], //相片列表
checkImg: "", //选中的图片
checkImg: '', //选中的图片
}
},
onLoad() { //代替 vue 里面的 created
......@@ -35,31 +35,31 @@
methods: {
handleDownload(url) { // 下载功能
uni.showLoading({
title: "下载中",
title: '下载中',
mask: true
})
let fileName = new Date().valueOf(); //获取时间戳
let fileName = new Date().valueOf() //获取时间戳
uni.downloadFile({ //下载文件资源到本地
url,
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.jpg', //filePath指定文件下载后存储的路径,wx.env.USER_DATA_PATH,时间戳为文件名
success: res => { //下载到本地成功
let filePath = res.filePath;
let filePath = res.filePath
uni.saveImageToPhotosAlbum({ //保存视频到系统相册。
filePath,
success: file => { //保存成功
//删除本地缓存
let fileMgr = uni.getFileSystemManager();
let fileMgr = uni.getFileSystemManager()
fileMgr.unlink({
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.jpg',
})
uni.showToast({
title: "下载成功",
icon: "success",
title: '下载成功',
icon: 'success',
mask: true
})
},
fail: err => {
uni.hideLoading();
uni.hideLoading()
//拒绝授权时显示
if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
uni.showModal({
......@@ -92,7 +92,7 @@
})
},
fail: err => { //下载失败
uni.hideLoading();
uni.hideLoading()
if (err.errMsg == 'downloadFile:fail createDownloadTask:fail url not in domain list') {
uni.showToast({
title: '服务器错误,请联系相关管理员',
......@@ -104,11 +104,11 @@
})
},
getPhotoData() { //获取用户vlog图片
this.$request("wechatUser/myPage/getVlogRecord", {
openid: uni.getStorageSync("openid"),
this.$request('wechatUser/myPage/getVlogRecord', {
openid: uni.getStorageSync('openid'),
productType: 1
}).then(res => {
if (res.code === "00") {
if (res.code === '00') {
this.list = res.data
} else {
uni.showModal({
......
......@@ -22,7 +22,7 @@
data() {
return {
myVlogList: [], //我的视频列表
merchantId: "", //景区id
merchantId: '', //景区id
}
},
onLoad(options) {
......@@ -40,12 +40,12 @@
onShareAppMessage(res) { //分享
let productId = res.target.dataset.productid
let productUrl= res.target.dataset.producturl
if (res.from === "button") {
this.$request("wechatUser/myPage/updateVlogRecord", {
if (res.from === 'button') {
this.$request('wechatUser/myPage/updateVlogRecord', {
productId,
openid: uni.getStorageSync("openid")
openid: uni.getStorageSync('openid')
}).then(res => {
if (res.code === "00") {
if (res.code === '00') {
this.getMyVlogList()
}
})
......@@ -64,11 +64,11 @@
},
methods: {
getMyVlogList() { //获取景区vlog列表
this.$request("wechatUser/myPage/getVlogRecord", {
openid: uni.getStorageSync("openid"),
this.$request('wechatUser/myPage/getVlogRecord', {
openid: uni.getStorageSync('openid'),
productType:0
}).then(res => {
if (res.code === "00") {
if (res.code === '00') {
res.data.forEach(item => { //获取当前景区视频列表
if (this.merchantId === item.merchantId) {
this.myVlogList = item.vlogList
......@@ -86,31 +86,31 @@
},
handleDownload(url) { // 下载功能
uni.showLoading({
title: "下载中",
title: '下载中',
mask: true
})
let fileName = new Date().valueOf(); //获取时间戳
let fileName = new Date().valueOf() //获取时间戳
uni.downloadFile({ //下载文件资源到本地
url,
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4', //filePath指定文件下载后存储的路径,wx.env.USER_DATA_PATH,时间戳为文件名
success: res => { //下载到本地成功
let filePath = res.filePath;
let filePath = res.filePath
uni.saveVideoToPhotosAlbum({ //保存视频到系统相册。
filePath,
success: file => { //保存成功
//删除本地缓存
let fileMgr = uni.getFileSystemManager();
let fileMgr = uni.getFileSystemManager()
fileMgr.unlink({
filePath: wx.env.USER_DATA_PATH + '/' + fileName + '.mp4',
})
uni.showToast({
title: "下载成功",
icon: "success",
title: '下载成功',
icon: 'success',
mask: true
})
},
fail: err => {
uni.hideLoading();
uni.hideLoading()
//拒绝授权时显示
if (err.errMsg === 'saveVideoToPhotosAlbum:fail auth deny') {
uni.showModal({
......@@ -143,7 +143,7 @@
})
},
fail: err => { //下载失败
uni.hideLoading();
uni.hideLoading()
if (err.errMsg == 'downloadFile:fail createDownloadTask:fail url not in domain list') {
uni.showToast({
title: '服务器错误,请联系相关管理员',
......
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 to comment