Commit 8274b529 by yuzhenWang

合并发布测试

parents 3318ab07 ffb43c6d
...@@ -141,14 +141,30 @@ ...@@ -141,14 +141,30 @@
} catch (err) { } catch (err) {
console.error('检查用户状态失败:', err); console.error('检查用户状态失败:', err);
} }
return
}else {
this.checkToken()
} }
}, },
// 清除登录状态 // 清除登录状态
clearLoginState() { clearLoginState() {
uni.clearStorageSync(); uni.clearStorageSync();
uni.setStorageSync('loginType', 'visitor'); uni.setStorageSync('loginType', 'visitor');
this.checkToken()
// 可以在这里添加其他需要清除的状态 // 可以在这里添加其他需要清除的状态
}, },
// 未登录状态下需要重新获取token
checkToken(){
api.checkToken().then(res=>{
if(res['success']){}else{
api.obtainToken().then(res=>{
if(res.success){
uni.setStorageSync('uni-token',res.data['token']);
}
})
}
})
},
// 处理外部链接参数 // 处理外部链接参数
handleExternalUrlParams() { handleExternalUrlParams() {
// #ifdef H5 // #ifdef H5
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<view class="imgContainer"> <view class="imgContainer">
<image <image
style="display: block;" style="display: block;"
src="@/static/images/shareBg.png" src="@/static/images/sharePoster.png"
mode="widthFix" mode="widthFix"
@load="handleBgImageLoad" @load="handleBgImageLoad"
@error="handleBgImageError" @error="handleBgImageError"
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
<view class="preview-container" v-if="generatedImage"> <view class="preview-container" v-if="generatedImage">
<image :src="generatedImage" mode="widthFix" class="preview-image"></image> <image :src="generatedImage" mode="widthFix" class="preview-image"></image>
</view> </view>
<view class="bottomBox">
长按保存图片分享给好友
</view>
</view> </view>
</template> </template>
...@@ -270,13 +266,68 @@ export default { ...@@ -270,13 +266,68 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// .container {
// display: flex;
// flex-direction: column;
// height: 100vh;
// width: 100vw;
// .imgBox {
// position: relative;
// .imgContainer {
// position: relative;
// .qrcode-container {
// position: absolute;
// bottom: 10rpx;
// right: 10rpx;
// background: #fff;
// padding: 10rpx;
// border-radius: 10rpx;
// box-shadow: 0 0 10rpx rgba(0,0,0,0.1);
// .qrcode-canvas {
// display: block;
// }
// }
// }
// }
// .preview-container{
// box-sizing: border-box;
// flex: 1;
// padding: 30rpx;
// width: 100%;
// height: 100%;
// .preview-image {
// width: 100%;
// height: auto;
// max-height: 100%;
// object-fit: contain;
// }
// }
// }
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh;
width: 100vw;
overflow: hidden;
.imgBox { .imgBox {
position: relative; width: 100%;
height: auto;
.imgContainer { .imgContainer {
width: 100%;
position: relative; position: relative;
image {
width: 100%;
height: auto;
display: block;
}
.qrcode-container { .qrcode-container {
position: absolute; position: absolute;
bottom: 10rpx; bottom: 10rpx;
...@@ -285,38 +336,28 @@ export default { ...@@ -285,38 +336,28 @@ export default {
padding: 10rpx; padding: 10rpx;
border-radius: 10rpx; border-radius: 10rpx;
box-shadow: 0 0 10rpx rgba(0,0,0,0.1); box-shadow: 0 0 10rpx rgba(0,0,0,0.1);
.qrcode-canvas { .qrcode-canvas {
display: block; display: block;
} }
} }
} }
} }
.bottomBox {
// flex: 1; .preview-container {
border-radius: 20rpx 20rpx 0 0; flex: 1;
height: 200rpx;
width: 100%; width: 100%;
height: 100%;
display: flex; display: flex;
align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; align-items: center;
background-color: #fff; overflow: hidden;
font-size: 28rpx;
button {
margin-top: 20rpx;
}
}
.preview-container{
box-sizing: border-box;
flex: 1;
padding: 80rpx 30rpx 0rpx 30rpx;
.preview-image {
width: 100%;
.preview-image {
height: 100%; /* 让高度占满屏幕 */
width: auto; /* 宽度自动调整 */
object-fit: fill;
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -265,6 +265,7 @@ ...@@ -265,6 +265,7 @@
} }
}) })
this.releaseScroll() this.releaseScroll()
this.checkToken()
} }
}) })
}, },
...@@ -273,6 +274,19 @@ ...@@ -273,6 +274,19 @@
delta: 1 delta: 1
}); });
}, },
// 未登录状态下需要重新获取token
checkToken(){
api.checkToken().then(res=>{
if(res['success']){}else{
api.obtainToken().then(res=>{
if(res.success){
uni.setStorageSync('uni-token',res.data['token']);
uni.setStorageSync('loginType', 'visitor');
}
})
}
})
},
cancel(){ cancel(){
uni.navigateBack({delta:1}) uni.navigateBack({delta:1})
}, },
......
...@@ -317,6 +317,7 @@ ...@@ -317,6 +317,7 @@
//分享 //分享
this.initShare(); this.initShare();
this.getOneProduct()
}, },
onLoad(options) { onLoad(options) {
if(options.sharePoster){ if(options.sharePoster){
...@@ -750,7 +751,22 @@ ...@@ -750,7 +751,22 @@
onChange: function(e) { onChange: function(e) {
this.old.x = e.detail.x this.old.x = e.detail.x
this.old.y = e.detail.y this.old.y = e.detail.y
},
getOneProduct() {
api.courseList().then(res => {
if (res['success']) {
let result = res['data']['data'];
if(result.length>0){
result.forEach(item=>{
if(item.productCode&&item.productCode=='C09'){
this.productItem = item
uni.setStorageSync('productItem',this.productItem );
}
})
} }
}
})
},
}, },
} }
</script> </script>
......
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