Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XX committed Sep 11, 2022
0 parents commit 906d7be
Show file tree
Hide file tree
Showing 39 changed files with 1,896 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/

# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes

# Node.js
node_modules/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 qweryuiop12321

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## 微信小程序:随申码

随申码是目前开发、优化较为成熟的一款小程序app。
其在近两年的大规模测试中运行稳定,且在UI设计、并发性能、功能实现等方面可圈可点。
在各省份的健康码程序中也是独树一帜的一款产品。

本仓库代码仅供热爱小程序开发的小伙伴们参考交流。

如若用于非法用途,本人保留依法追责的权利。

## 说明

使用本代码进行开发需要申请appid, 然后将其替换掉代码中的“xxxxx”:

![图片](./readme/appid.png)


## Show

![图片](./readme/index.png)

![图片](./readme/input_address.png)





2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// app.js
App({})
15 changes: 15 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"pages": [
"pages/index/index",
"pages/index_adress/index_adress"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#D0B686",
"navigationBarTitleText": "随申码",
"navigationBarTextStyle": "white",
"navigationStyle": "custom"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
9 changes: 9 additions & 0 deletions app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**app.wxss**/
.content {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;

}
Binary file added img/Title.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/acq_point.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/center_logo.bmp
Binary file not shown.
Binary file added img/center_logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/dot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/head.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/logo_text.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/name.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/qr_code.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/query.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/relatives.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/travel_card.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/vaccines.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions pages/index/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// pages/index_address/index_address.js
import drawQrcode from '../../utils/weapp.qrcode.esm.js'
var util_s = require('../../utils/util_s.js');
const app = getApp();
Page({
data: {
title: "",
address: "",
touchx: 0,
touchy: 0,
default_address:true
},

onLoad: function (options) {
// const query = wx.createSelectorQuery()
// query.select('#myQrcode')
// .fields({
// node: true,
// size: true
// })
// .exec((res) => {
// var canvas = res[0].node

// // 调用方法drawQrcode生成二维码
// drawQrcode({
// canvas: canvas,
// canvasId: 'myQrcode',
// width: 200,
// height:200,
// padding: 30,
// background: "#FFFFFF",
// foreground: '#09BC68',
// text: '个人二维码信息',

// })
// wx.canvasToTempFilePath({
// canvasId: 'myQrcode',
// canvas: canvas,
// x: 0,
// y: 0,
// width: 200,
// height: 200,
// destWidth: 200,
// destHeight: 200,
// success(res) {
// console.log('二维码临时路径:', res.tempFilePath)
// },
// fail(res) {
// console.error(res)
// }
// })
// })

var that = this;
// get init brightness
wx.getScreenBrightness({
success: function (res) {that.setData({ScreenBrightness: res.value})}
})
wx.setScreenBrightness({value: 1})
// update time every second
setInterval(function () {
that.setData({
Time: util_s.formatTime(new Date()),
Time_s: util_s.formatTime_s(new Date())
});
}, 1000);
},

// 记录触摸起点
touchStart(e) {
var that = this;
that.setData({
touchx: e.changedTouches[0].clientX,
touchy: e.changedTouches[0].clientY,
})
},

touchEnd(e) {
var that = this;
let x = e.changedTouches[0].clientX;
let y = e.changedTouches[0].clientY;
let turn = "";
if (x - that.data.touchx > 50 && Math.abs(y - that.data.touchy) < 50) { //右滑
turn = "right"
} else if (x - that.data.touchx < -50 && Math.abs(y - that.data.touchy) < 50) { //左滑
turn="left";
}
//根据方向进行操作
if(turn == 'left'){
wx.navigateTo({
url: '../index_adress/index_adress',
}) ;
}
},
// set brightness to init
onUnload: function () {
wx.setScreenBrightness({value: this.data.ScreenBrightness})
},
})
3 changes: 3 additions & 0 deletions pages/index/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
84 changes: 84 additions & 0 deletions pages/index/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<view class="content" bindtouchstart="touchStart" bindtouchend="touchEnd">
<text style="color: white;margin-top: 100rpx;">随申码</text>

<view class="container" style="height: 70%; margin-top:20rpx">

<image style="width:100%;height:60rpx;" src="../../img/head.jpg" />
<image style="width:130rpx;height:130rpx;margin:25rpx" src="../../img/logo_text.jpg" />
<image style="width: 140rpx; height: 35rpx; margin: 10rpx" src="../../img/name.jpg" />
<image style="width: 260rpx; height: 60rpx; margin: 10rpx 0rpx 30rpx 0rpx" src="../../img/relatives.jpg" />

<view class="time_content">
<view class="cur_time">{{Time}}</view>
<view class="cur_time_s" style="position: relative; left: 0rpx; top: 2rpx">{{Time_s}}</view>
</view>

<image style="width:380rpx;height:380rpx;" src="../../img/qr_code.jpg" />
<!-- <canvas type="2d" style="width: 200px; height: 200px;margin-top: 0rpx; " id="myQrcode"></canvas> -->

<text style="font-size: 40rpx;font-weight: bold;color: #19B66E;margin:5rpx" >绿色</text>
<!-- 默认显示内容 -->
<view wx:if="{{default_address}}" style="display: flex;flex-direction: row;align-items: center;justify-content: center;margin-top: 20rpx;">
<text style="font-size: 30rpx;font-weight: bold;color: #846654;margin:5rpx" >已支持刷公交、医保</text>
<button class="capsule_button" style="width: 130rpx; height: 56rpx; display: block; box-sizing: border-box; padding: 8rpx;margin:5rpx">去配置</button>
</view>

<view wx:if="{{!default_address}}" class="address_block" style="display: flex;flex-direction: column;align-items: center;justify-content: center;margin-top: 20rpx;">
<text class="address_title" >{{title}}</text>
<text class="address_info" >{{address}}</text>
</view>



<view style="display: flex; flex-direction: row; align-items: flex-end; justify-content: center; width: 550rpx; height: 90rpx; box-sizing: border-box;margin-bottom: 30rpx;">
<text style="font-size: 75rpx; font-weight: bold; color: #19B66E; margin: 0rpx; position: relative; left: -4rpx; top: 10rpx" >24</text>
<text style="font-size: 30rpx;margin:0rpx">小时内核酸检测结果</text>
<text style="font-size: 30rpx;font-weight: bold;color: #19B66E;margin:0rpx" >【阴性】</text>
</view>
</view>

<view class="container" style="height:15%;margin-top: 30rpx;">
<!-- bottom icon and name -->
<view style="display:flex;flex-direction:row;margin-top: 40rpx;">
<view style="display:flex;flex-direction:column;align-items: center;margin-right:60rpx">
<image style="width:80rpx;height:80rpx;" src="../../img/vaccines.jpg"/>
<text style="font-size: 24rpx;font-weight: bold;margin:10rpx" >疫苗&核酸</text>
</view>

<view style="display:flex;flex-direction:column;align-items: center;margin-right:60rpx">
<image style="width:80rpx;height:80rpx;" src="../../img/acq_point.jpg"/>
<text style="font-size: 24rpx;font-weight: bold;margin:10rpx" >采样点</text>
</view>

<view style="display:flex;flex-direction:column;align-items: center;margin-right:60rpx">
<image style="width:80rpx;height:80rpx;" src="../../img/query.jpg"/>
<text style="font-size: 24rpx;font-weight: bold;margin:10rpx" >抗原查询</text>
</view>

<view style="display:flex;flex-direction:column;align-items: center;">
<image style="width:80rpx;height:80rpx;" src="../../img/travel_card.jpg"/>
<text style="font-size: 24rpx;font-weight: bold;margin:10rpx" >行程卡</text>
</view>
</view>

<!-- dot image -->
<image style="width:70rpx;height:16rpx;" src="../../img/dot.jpg" />

<!-- bottom words -->
<view style="display: flex;flex-direction: row;">
<text class="bottom_text">常见问题</text>
<text class="bottom_text">|</text>
<text class="bottom_text">智能客服</text>
<text class="bottom_text">|</text>
<text class="bottom_text">扫码记录</text>
<text class="bottom_text">|</text>
<text class="bottom_text">我要申诉</text>
</view>


</view>

</view>



78 changes: 78 additions & 0 deletions pages/index/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/* pages/index_address/index_address.wxss */
page {
height: 100%;
background: -webkit-linear-gradient(left, #E1C897, #C7AC7D);
}

.cur_time_s {
flex-direction: row;
align-items: flex-start;
font-size: 20px;
font-weight: bold;
}
.cur_time {
display: flex;
flex-direction: row;
align-items: flex-start;
font-size: 16px;
}

.time_content{
display: flex;
flex-direction: row;
justify-content:flex-start;
align-items: flex-end;
margin-bottom: 5rpx;
}

.capsule_button{
color: #937068;
font-size: 28rpx;
font-weight: 500;
text-align: center;
border-color: #937068;
border-radius: 34rpx;
border: solid;
border-width: thin;
}
.container{
text-align: center;
display: flex;
align-items: center;
flex-direction: column;
border-width: 2px;
border-radius: 10px;
border-color: white;
background-color: white;
width:90%;
display: flexbox;
box-sizing: border-box;
}

.bottom_text{
font-size: 24rpx;
font-weight: 500;
color: #B39A6D;
margin:10rpx;
}

.address_block{
width: 94%;
background-color: #F8F5F0;
border-radius: 20rpx;
}

.address_title{
font-size: 36rpx;
font-weight: 500;
font-weight: bold;
color: #8E635B;
margin:10rpx 40rpx;
}

.address_info{
font-size: 30rpx;
font-weight: 400;
color: #7F5B54;
margin:10rpx 90rpx;
}
Loading

0 comments on commit 906d7be

Please sign in to comment.