chore: 首次纳入版本控制(审查前基线,v1.2.0)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
const cfg = require("../../utils/config");
|
||||
const api = require("../../utils/api");
|
||||
|
||||
Page({
|
||||
data: { url: "", err: "" },
|
||||
onLoad() {
|
||||
const base = (cfg.apiBase || "").replace(/\/$/, "");
|
||||
wx.setNavigationBarTitle({ title: "做题工作台" });
|
||||
// 一次性门票:2 分钟、只能换一次,比在 URL 里长期带 token 安全
|
||||
api.request("POST", "/api/auth/web-ticket", { base_url: base })
|
||||
.then(r => this.setData({ url: (r && r.url) || (base + "/workbench?ticket=" + (r && r.ticket)) }))
|
||||
.catch(e => this.setData({ err: (e && e.message) || "打不开工作台" }));
|
||||
},
|
||||
onRetry() {
|
||||
this.setData({ url: "", err: "" });
|
||||
this.onLoad();
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "做题工作台",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<web-view wx:if="{{url}}" src="{{url}}"></web-view>
|
||||
<view class="err" wx:if="{{err}}">
|
||||
<view class="t">打不开工作台</view>
|
||||
<view class="s">{{err}}</view>
|
||||
<button class="b" bindtap="onRetry">重新打开</button>
|
||||
<view class="n">如果一直不行:① 手机和电脑连同一个网 ② 小程序的业务域名里加上这个地址(https)③ 回首页用「拍一张」先录题,做题不耽误</view>
|
||||
</view>
|
||||
@@ -0,0 +1,6 @@
|
||||
/* web-view 占满整屏 */
|
||||
.err{padding:80rpx 56rpx;text-align:center}
|
||||
.err .t{font-size:34rpx;font-weight:600;color:#24211f}
|
||||
.err .s{margin-top:16rpx;font-size:26rpx;color:#9a8c7a;word-break:break-all}
|
||||
.err .b{margin-top:36rpx;background:#e4634a;color:#fff;border-radius:14rpx;font-size:30rpx}
|
||||
.err .n{margin-top:36rpx;font-size:24rpx;color:#9a8c7a;line-height:1.7;text-align:left}
|
||||
Reference in New Issue
Block a user