Commit ced880c6 authored by Damon's avatar Damon

水印缓存

parent 7b457c5e
......@@ -62,7 +62,8 @@
</view>
</template>
<script>
<script>
import cache from '../../common/cache.js'
export default {
data() {
return {
......@@ -138,38 +139,51 @@
getItemList: function() {
// this.systemId = '79550af260555cc20afb34156c94b32c' // 测试数据
this.loading = true
this.$u.cloudApi.getUserWatermark({
'token': getApp().globalData.token,
'system_id': this.systemId
}).then(res => {
if (res && res.result) {
if(res.result.error_code){
uni.showToast({title: res.result.error_msg})
}else{
this.result = res.result
}
}else{
uni.showToast({title: '网络异常'})
}
this.loading = false
})
// this.loading = true
// this.$u.cloudApi.getUserWatermark({
// 'token': getApp().globalData.token,
// 'system_id': this.systemId
// }).then(res => {
// if (res && res.result) {
// if(res.result.error_code){
// uni.showToast({title: res.result.error_msg})
// }else{
// this.result = res.result
// }
// }else{
// uni.showToast({title: '网络异常'})
// }
// this.loading = false
// })
// 离线处理方案
this.loading = false
const photo = getApp().globalData.photo
const data = cache.getCache(this.systemId)
this.result = data.result[photo.topIndex].userWatermark
},
saveUserWatermark: function() {
this.loading = true
this.$u.cloudApi.saveUserWatermark({
'token': getApp().globalData.token,
'watermark': this.result
}).then(res => {
if (res.result.code == true) {
const photo = getApp().globalData.photo
photo.waterSetting = this.result
}else{
uni.showToast({title: res.result.msg})
}
this.loading = false
})
saveUserWatermark: function() {
// this.loading = true
// this.$u.cloudApi.saveUserWatermark({
// 'token': getApp().globalData.token,
// 'watermark': this.result
// }).then(res => {
// if (res.result.code == true) {
// const photo = getApp().globalData.photo
// photo.waterSetting = this.result
// }else{
// uni.showToast({title: res.result.msg})
// }
// this.loading = false
// })
// 离线处理方案
const photo = getApp().globalData.photo
const data = cache.getCache(this.systemId)
data.result[photo.topIndex].userWatermark = this.result
cache.setCache(this.systemId, data)
photo.waterSetting = this.result
},
//保存原图 开关
......
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