Skip to content

Commit

Permalink
增加检测更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Redcker committed Aug 4, 2022
1 parent 4de97ae commit 952352f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
5 changes: 5 additions & 0 deletions App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
background-image: linear-gradient(to top, #accbee 0%, #e7f0fd 100%);
}
.f-14 {
font-size: 14px !important;
}
Expand All @@ -44,6 +45,10 @@
font-size: 11px !important;
}
.f-12 {
font-size: 11px !important;
}
.text-center {
text-align: center;
}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- [Vue2](https://v2.vuejs.org/) - 熟悉 Vue 基础语法
- [TypeScript](https://www.javascript.com/) - 熟悉`JavaScript`基本语法
- [Es6+](http://es6.ruanyifeng.com/) - 熟悉 es6 基本语法
- [uniapp](https://uni-app.dcloud.net.cn/) - 熟悉uniapp基本用法
- [uView UI](https://www.uviewui.com/) - 熟悉ui的基本使用
- [uCharts](https://www.ucharts.cn/) - 熟悉图表库的基本使用
- [Hbuilder X](https://www.dcloud.io/hbuilderx.html) - 开发IDE
Expand Down
26 changes: 25 additions & 1 deletion pages/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
</view>
</u-modal>
<u-toast ref="uToast"></u-toast>
<view class="text-center tips-text f-12" @click="update">{{updateStr}}</view>
</view>
</template>

Expand Down Expand Up @@ -71,12 +72,15 @@
btnLoading: false,
menuShow: false,
currentEvent: {},
getFocusTime: getFocusTime
getFocusTime: getFocusTime,
updateStr: '',
isUpdate: false
}
},
async onLoad() {
this.eventList = await selectEvent()
this.loading = false
this.getUpdate()
},
async onShow() {
this.eventList = await selectEvent()
Expand Down Expand Up @@ -118,6 +122,26 @@
message: "添加成功",
position: 'top'
})
},
getUpdate() {
this.updateStr = '当前版本:' + plus.runtime.version
uni.request({
url: 'https://api.github.com/repos/Redcker/lemonTODO/releases/latest',
success: (res) => {
let currentVersion = res.data['tag_name']
if (currentVersion > plus.runtime.version) {
this.isUpdate = true
this.updateStr = '有新版本啦,点我更新!'
}
}
})
},
update() {
if (this.isUpdate) {
plus.runtime.openURL('https://jq.qq.com/?_wv=1027&k=7wqdsB20', function(res) {
console.log(res);
});
}
}
}
}
Expand Down

0 comments on commit 952352f

Please sign in to comment.