Commit ced880c6 authored by Damon's avatar Damon

水印缓存

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