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

图片bug修复

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