Skip to content

Commit

Permalink
Update content [skip ci]
Browse files Browse the repository at this point in the history
Signed-off-by: Kang Huaishuai <khs1994@khs1994.com>
  • Loading branch information
khs1994 committed Jun 26, 2021
1 parent 8d9a009 commit 2a9c7cf
Show file tree
Hide file tree
Showing 22 changed files with 258 additions and 58 deletions.
5 changes: 4 additions & 1 deletion client/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
"workers": "workers",
"darkmode": true,
"themeLocation": "theme.json",
"lazyCodeLoading": "requiredComponents"
"lazyCodeLoading": "requiredComponents",
"useExtendedLib": {
"weui": true
}
}
2 changes: 1 addition & 1 deletion client/pages/book/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
style="height:70vh;width:100vw" show-menu-by-longpress="{{true}}"
/>

<button type="warn" class="btn_buy" bind:tap="buyBook">JD.COM 立即购买</button>
<button type="warn" class="btn_buy" bind:tap="share">长按图片前往京东购买</button>

<button type="primary" class="btn_share" bind:tap="share">分享</button>
2 changes: 1 addition & 1 deletion client/pages/docker/index/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ speed="1200" backgroundcolor="#fff" color="#36a1f0" wx:if="{{lazy}}"
<i-spin fix></i-spin>
</view>

<ad unit-id="{{isqq ? 'f2ba7917096dc03c7d798df304a90c49' : 'adunit-7f0bb210d33e2f9a'}}" ad-type="grid" grid-opacity="0.8" grid-count="5" ad-theme="white"></ad>
<ad unit-id="{{isqq ? 'f2ba7917096dc03c7d798df304a90c49' : 'adunit-1246f0a5e441ea4c'}}" ad-intervals="30" ad-theme="white"></ad>

<markdown markdown="{{data}}" isTowxml="{{false}}" navigator="{{false}}" theme="{{theme}}"></markdown>

Expand Down
3 changes: 2 additions & 1 deletion client/pages/docker/summary/index.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"usingComponents": {
"i-notice-bar": "/src/ui/iviewui/dist/notice-bar/index"
"i-notice-bar": "/src/ui/iviewui/dist/notice-bar/index",
"mp-searchbar": "weui-miniprogram/searchbar/searchbar"
},
"navigationStyle": "default",
"enablePullDownRefresh": true,
Expand Down
8 changes: 8 additions & 0 deletions client/pages/docker/summary/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ Page({
return;
}

if (id === 'chengxin') {
const imgUrl = 'https://dpsigs.coding.net/p/docker_practice/d/docker-practice.com/git/raw/master/chengxin.png';
wx.navigateTo({
url: `/pages/random/index?imgUrl=${imgUrl}`
});
return;
}

if (id === 'github') {
this.github();
return;
Expand Down
4 changes: 2 additions & 2 deletions client/pages/docker/summary/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ speed="1200" backgroundcolor="{{theme === 'white' ? '#fff': '#000'}}" color="#36
</view>

<view class="adContainer" wx:if="{{theme === 'white'}}">
<ad unit-id="{{isqq ? 'f2ba7917096dc03c7d798df304a90c49' : 'adunit-4478ecdd36509a60'}}" ad-type="grid" grid-opacity="0.8" grid-count="5" ad-theme="light"></ad>
<ad unit-id="{{isqq ? 'f2ba7917096dc03c7d798df304a90c49' : 'adunit-1246f0a5e441ea4c'}}" ad-intervals="30" ad-theme="light"></ad>
</view>
<view class="adContainer" wx:else>
<ad unit-id="{{isqq ? 'f2ba7917096dc03c7d798df304a90c49' : 'adunit-4478ecdd36509a60'}}" ad-type="grid" grid-opacity="0.8" grid-count="5" ad-theme="black"></ad>
<ad unit-id="{{isqq ? 'f2ba7917096dc03c7d798df304a90c49' : 'adunit-1246f0a5e441ea4c'}}" ad-intervals="30" ad-theme="black"></ad>
</view>

</view>
Expand Down
52 changes: 48 additions & 4 deletions client/pages/index/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<view class="userinfo">
<button class="getUserInfoBtn" wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<!-- <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image> -->
<text class="userinfo-nickname">Get started with Docker now</text>
</block>
</view>
Expand All @@ -19,47 +19,91 @@
</i-switch>
</i-cell> -->
<i-cell title="积分" value="{{jifen}}"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="今日签到" value="{{signNum}}"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="切换主题" value="{{theme}}" bind:click="changeTheme"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="切换源" value="加载缓慢? 换个源试试" bind:click="switchSource"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="渲染引擎" value="{{mdEngine}}" bind:click="switchEngine"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="{{gitHubStatus}}" value="提出 issue" bind:click="loginGitHub"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="清理缓存" value="{{storageSize}}" bind:click="cleanup"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="字体" value="{{fontType}}" bind:click="chooseFont"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="👍 打赏" value="长按识别二维码进行打赏" bind:click="zan"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="📕 实体书" value="进阶学习" bind:click="buyBook"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="📁 收藏夹" value="马上找到你要的内容" bind:click="favorites"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="经典目录" value="怀旧经典" bind:click="oldMenu"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="技术交流" value="GitHub" bind:click="copyLink"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="分享" value="展示小程序码" bind:click="share"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="评分">
<i-rate title="评分" bind:change="rate" value="{{rate_index}}" slot="footer"></i-rate>
</i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="累积用户" value="{{userNum}}"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="SDK 版本" value="{{sdkVersion}}"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="版本" value="{{version}}"></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="" value=""><button plain="{{true}}" open-type="contact">智能客服</button></i-cell>
<!-- <i-cell title="" value=""><button plain="{{true}}" bind:tap="tucao">Docker 社区</button></i-cell> -->
<i-cell title="" value=""><button plain="{{true}}" open-type="feedback">反馈</button></i-cell>
<i-cell title="" value=""><button plain="{{true}}" open-type="openSetting">授权设置</button></i-cell>
</i-cell-group>

<!-- <i-cell title="" value=""><button plain="{{true}}" bind:tap="tucao">Docker 社区</button></i-cell> -->

<i-cell-group>
<i-cell title="" value=""><button plain="{{true}}" open-type="feedback">反馈</button></i-cell>
</i-cell-group>

<i-cell-group>
<i-cell title="" value=""><button plain="{{true}}" open-type="openSetting">授权设置</button></i-cell>
</i-cell-group>

</i-panel>
</view>
3 changes: 2 additions & 1 deletion client/pages/login/index.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"usingComponents": {
"i-button": "/src/ui/iviewui/dist/button/index"
"i-button": "/src/ui/iviewui/dist/button/index",
"mp-icon": "weui-miniprogram/icon/icon"
},
"navigationBarTitleText": "GitHub 登录",
"navigationStyle": "default",
Expand Down
55 changes: 42 additions & 13 deletions client/pages/login/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ Page({
isloading: false,
// username: '',
// password: '',
color: 'black', // white
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {},
onLoad: function () {
wx.getSystemInfo({
success:(res)=>{
this.setData({
color: res.theme == 'dark' ? 'white' : 'black'
})
}
})
},

/**
* 生命周期函数--监听页面初次渲染完成
Expand Down Expand Up @@ -44,14 +53,33 @@ Page({
*/
onReachBottom: function () {},

login(res: any) {
async login(res: any) {
// console.log(res);
const username = res.detail.value.username;
let password = res.detail.value.password;

if(!username){
wx.showModal({
content: "请输入用户名",
showCancel: false,
});

return;
}

this.setData!({
isloading: true,
isloading: password != "",
isScanQrLoading: password == "",
});

// console.log(res);
const username = res.detail.value.username;
const password = res.detail.value.password;
if (!password) {
password = await wx.scanCode({}).then((res) => {
const result = res.result;
console.log("==> Get token from qr: " + result);

return result;
});
}

// const username = this.data.username;
// const password = this.data.password;
Expand All @@ -63,14 +91,14 @@ Page({
fs.writeFileSync(
`${wx.env.USER_DATA_PATH}/token`,
`${username}:${password}`,
'utf-8',
"utf-8",
);
const token = fs.readFileSync(`${wx.env.USER_DATA_PATH}/token`, 'base64');
const token = fs.readFileSync(`${wx.env.USER_DATA_PATH}/token`, "base64");

wx.request({
url: 'https://ci.khs1994.com/proxy_github_api/user',
url: "https://ci.khs1994.com/proxy_github_api/user",
header: {
Authorization: 'Basic ' + token,
Authorization: "Basic " + token,
},
success: (res: any) => {
if (res.statusCode !== 200) {
Expand All @@ -80,7 +108,7 @@ Page({
}

wx.showToast({
title: '登录成功',
title: "登录成功",
});

setTimeout(() => {
Expand All @@ -104,11 +132,12 @@ Page({

this.setData!({
isloading: false,
isScanQrLoading: false,
});

wx.showModal({
title: '登录失败',
content: '请检查用户名及密码是否正确',
title: "登录失败",
content: "请检查用户名及密码是否正确",
showCancel: false,
});
},
Expand Down
14 changes: 12 additions & 2 deletions client/pages/login/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
<form bindsubmit="login">
<input placeholder="GitHub Username" name="username" id="username"
auto-focus></input>
<input placeholder="Password" type="password" name="password" id="password"
<!-- https://docs.github.com/en/rest/overview/other-authentication-methods -->
<input placeholder="Personal Access Tokens (PAT)" type="password" name="password" id="password"
></input>
<button form-type="submit" loading="{{isloading}}">登录</button>
<button form-type="submit" loading="{{isloading}}">登录 GitHub</button>
<button form-type="submit" loading="{{isScanQrLoading}}">
<mp-icon icon="qr-code" color="{{color}}" size="{{20}}"></mp-icon>
扫描二维码登录 GitHub</button>

<form style="margin-left:10%;">
<mp-icon icon="info" color="{{color}}" size="{{20}}"></mp-icon>
请扫描含有 PAT 信息的二维码
</form>

</form>
12 changes: 12 additions & 0 deletions client/pages/login/index.wxss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
page {
background-color: #36a1f0;
margin-top: 35%;
}

#username {
Expand All @@ -23,3 +24,14 @@ page {
.loginButton {
color: #36a1f0!important;
}

input{
margin-left: 30rpx;
margin-right: 30rpx;
}

button {
margin-top: 10rpx;
margin-left: 30rpx;
margin-right: 30rpx;
}
2 changes: 1 addition & 1 deletion client/pages/news/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"usingComponents": {},
"navigationStyle": "default",
"enablePullDownRefresh": false,
"navigationBarTitleText": "容器生态"
"navigationBarTitleText": "容器生态最新动态"
}
2 changes: 1 addition & 1 deletion client/pages/news/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</view>
</view>

<ad unit-id="{{isqq ? 'a4f45b9d8d5704ab70bebfd0780854a8' : 'adunit-3ea71b7cfce6c721'}}" ad-intervals="30"></ad>
<ad unit-id="{{isqq ? 'a4f45b9d8d5704ab70bebfd0780854a8' : 'adunit-1246f0a5e441ea4c'}}" ad-intervals="30"></ad>

<view class="weui-footer">
<view class="weui-footer__text">©docker-practice.com</view>
Expand Down
3 changes: 2 additions & 1 deletion client/pages/random/index.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"usingComponents": {}
"usingComponents": {},
"navigationStyle": "default"
}
Loading

0 comments on commit 2a9c7cf

Please sign in to comment.