|
@@ -124,7 +124,7 @@ VueLikePage([], {
|
|
|
daojishi: 0,
|
|
|
isShot: false,
|
|
|
isRecord: false,
|
|
|
- currentScene: 1,
|
|
|
+ currentScene: this.data.scenes[0] ? this.data.scenes[0].id : 1,
|
|
|
recordjishi: 10,
|
|
|
});
|
|
|
if (!noswitch) {
|
|
@@ -173,24 +173,29 @@ VueLikePage([], {
|
|
|
onLoad: function (options) {
|
|
|
console.log("options: ", options);
|
|
|
|
|
|
- if (options.machineid) {
|
|
|
- app.id = options.machineid;
|
|
|
- }
|
|
|
+ wx.showLoading({
|
|
|
+ title: "资源加载中",
|
|
|
+ });
|
|
|
|
|
|
- this.getData(options.projectid);
|
|
|
+ if (options && options.scene) {
|
|
|
+ const [machineid, authorCode] = options.scene.split("_");
|
|
|
|
|
|
- // 1、获取二维码传参
|
|
|
- if (options.authorCode) {
|
|
|
- this.setData({
|
|
|
- authorCode: decodeURIComponent(options.authorCode),
|
|
|
- });
|
|
|
- this.start(this.data.authorCode);
|
|
|
- }
|
|
|
+ app.id = machineid;
|
|
|
+ // 1、获取二维码传参
|
|
|
+ if (authorCode) {
|
|
|
+ this.setData({
|
|
|
+ authorCode: decodeURIComponent(authorCode),
|
|
|
+ });
|
|
|
+ this.start(this.data.authorCode);
|
|
|
+ }
|
|
|
|
|
|
- if (wx.getStorageSync("records")) {
|
|
|
- this.setData({
|
|
|
- records: JSON.parse(wx.getStorageSync("records")),
|
|
|
- });
|
|
|
+ if (wx.getStorageSync("records")) {
|
|
|
+ this.setData({
|
|
|
+ records: JSON.parse(wx.getStorageSync("records")),
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.getData();
|
|
|
}
|
|
|
|
|
|
// wx.setStorageSync('records', JSON.stringify(this.data.records))
|
|
@@ -210,11 +215,7 @@ VueLikePage([], {
|
|
|
// })
|
|
|
},
|
|
|
|
|
|
- getData(prjId = "ZHS2305758-1") {
|
|
|
- wx.showLoading({
|
|
|
- title: "资源加载中",
|
|
|
- });
|
|
|
-
|
|
|
+ getData(prjId = "ZHS2305758-1", scenes) {
|
|
|
this.setData({
|
|
|
cdn_url: CDN_URL + "/" + prjId,
|
|
|
});
|
|
@@ -223,10 +224,18 @@ VueLikePage([], {
|
|
|
url:
|
|
|
`${VIDEO_BASE_URL}project/4dage-sxb/${prjId}/config.json?t=` +
|
|
|
new Date().getTime(),
|
|
|
- success: ({ data: { scenes, title, ...rest } }) => {
|
|
|
+ success: ({ data: { scenes: sourceScenes, title, ...rest } }) => {
|
|
|
+ let scenesData = sourceScenes;
|
|
|
+ if (scenes) {
|
|
|
+ // 只展示 scenes 中存在的id
|
|
|
+ scenesData = scenes.map((id) =>
|
|
|
+ sourceScenes.find((scene) => id === scene.id)
|
|
|
+ );
|
|
|
+ }
|
|
|
this.setData(
|
|
|
{
|
|
|
- scenes: scenes,
|
|
|
+ currentScene: scenesData[0].id,
|
|
|
+ scenes: scenesData,
|
|
|
info: rest,
|
|
|
},
|
|
|
() => {
|
|
@@ -479,6 +488,13 @@ VueLikePage([], {
|
|
|
this.disconnect();
|
|
|
// app.showAlert("网络异常,请稍后再试");
|
|
|
}
|
|
|
+
|
|
|
+ try {
|
|
|
+ const res = JSON.parse(data);
|
|
|
+ this.getData(res.projectID, res.scenes);
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
console.log(data, "data");
|
|
|
}, authorCode);
|
|
|
});
|