|
@@ -1,7 +1,7 @@
|
|
|
-import {miniProgramConfig} from '../../api/other';
|
|
|
+import {miniProgramConfig,sharePoster} from '../../api/other';
|
|
|
import {BASE_URL} from '../../utils/request';
|
|
|
import {isLoggedIn,doLogin} from '../../utils/auth';
|
|
|
-import { REPORT_BEHAVIOR,DRAW_POSTER } from '../../utils/util.js';
|
|
|
+import { REPORT_BEHAVIOR,DRAW_POSTER,base64ToFilePath } from '../../utils/util.js';
|
|
|
const app = getApp();
|
|
|
Page({
|
|
|
data: {
|
|
@@ -42,6 +42,9 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ onHide(){
|
|
|
+ this.setData({ showShare: false });
|
|
|
+ },
|
|
|
updateData(data){
|
|
|
this.setData({
|
|
|
banners:data.carousels,
|
|
@@ -125,9 +128,15 @@ Page({
|
|
|
});
|
|
|
if (!needGenerate) return;
|
|
|
try {
|
|
|
- const path = await DRAW_POSTER();
|
|
|
- wx.setStorageSync('posterCache', { key: posterKey, path });
|
|
|
- this.setData({ posterImg: path });
|
|
|
+ // const path = await DRAW_POSTER();
|
|
|
+ const res = await sharePoster();
|
|
|
+ if(res.code == 200){
|
|
|
+ let path = await base64ToFilePath(res.data);
|
|
|
+ wx.setStorageSync('posterCache', { key: posterKey, path });
|
|
|
+ this.setData({ posterImg: path });
|
|
|
+ }else{
|
|
|
+ throw new Error();
|
|
|
+ }
|
|
|
} catch (err) {
|
|
|
this.setData({ posterLoading: false });
|
|
|
wx.showToast({ title: '生成海报失败', icon: 'none' });
|