first commit

This commit is contained in:
lf 2024-07-11 10:50:41 +08:00
commit 650d215ada
16 changed files with 760 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
unpackage
node_modules

16
.hbuilderx/launch.json Normal file
View File

@ -0,0 +1,16 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"default" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

20
App.vue Normal file
View File

@ -0,0 +1,20 @@
<script>
export default {
onLaunch: function () {
console.log('App Launch');
},
onShow: function () {
console.log('App Show');
},
onHide: function () {
console.log('App Hide');
}
};
</script>
<style>
/*每个页面公共css */
page {
height: 100%;
}
</style>

37
README.md Normal file
View File

@ -0,0 +1,37 @@
### 3 分钟了解如何进入开发
欢迎使用 Codeup通过阅读以下内容你可以快速熟悉 Codeup ,并立即开始今天的工作。
### 提交**文件**
首先,你需要了解在 Codeup 中如何提交代码文件,跟着文档「[__提交第一行代码__](https://thoughts.teambition.com/sharespace/5d88b152037db60015203fd3/docs/5dc4f6786b81620014ef7574)」一起操作试试看吧。
### 开启扫描
开发过程中为了更好的管理你的代码资产Codeup 内置了「[__代码规约扫描__](https://thoughts.teambition.com/sharespace/5d88b152037db60015203fd3/docs/5dc4f68b6b81620014ef7588)」和「[__敏感信息检测__](https://thoughts.teambition.com/sharespace/5d88b152037db60015203fd3/docs/5dc4f6886b81620014ef7587)」服务,你可以在代码库设置-集成与服务中一键开启,开启后提交或合并请求的变更将自动触发扫描,并及时提供结果反馈。
![](https://img.alicdn.com/tfs/TB1nRDatoz1gK0jSZLeXXb9kVXa-1122-380.png "")
![](https://img.alicdn.com/tfs/TB1PrPatXY7gK0jSZKzXXaikpXa-1122-709.png "")
### 代码评审
功能开发完毕后,通常你需要发起「[__代码合并和评审__](https://thoughts.teambition.com/sharespace/5d88b152037db60015203fd3/docs/5dc4f6876b81620014ef7585)」Codeup 支持多人协作的代码评审服务,你可以通过「[__保护分支__](https://thoughts.teambition.com/sharespace/5d88b152037db60015203fd3/docs/5dc4f68e6b81620014ef758c)」策略及「[__合并请求设置__](https://thoughts.teambition.com/sharespace/5d88b152037db60015203fd3/docs/5dc4f68f6b81620014ef758d)」对合并过程进行流程化管控,同时提供 WebIDE 在线代码评审及冲突解决能力,让你的评审过程更加流畅。
![](https://img.alicdn.com/tfs/TB1XHrctkP2gK0jSZPxXXacQpXa-1432-887.png "")
![](https://img.alicdn.com/tfs/TB1V3fctoY1gK0jSZFMXXaWcVXa-1432-600.png "")
### 编写文档
项目推进过程中,你的经验和感悟可以直接记录到 Codeup 代码库的「[__文档__](https://thoughts.teambition.com/sharespace/5d88b152037db60015203fd3/docs/5e13107eedac6e001bd84889)」内,让智慧可视化。
![](https://img.alicdn.com/tfs/TB1BN2ateT2gK0jSZFvXXXnFXXa-1432-700.png "")
### 成员协作
是时候邀请成员一起编写卓越的代码工程了,请点击右上角「成员」邀请你的小伙伴开始协作吧!
### 更多
Git 使用教学、高级功能指引等更多说明,参见[__Codeup帮助文档__](https://thoughts.teambition.com/sharespace/5d88b152037db60015203fd3/docs/5dc4f6756b81620014ef7571)。

28
api/index.js Normal file
View File

@ -0,0 +1,28 @@
// const baseUrl = "http://test.marketapi.1688sup.com"; //测试
// const baseUrl = "http://pre.marketapi.1688sup.com" //镜像
const baseUrl = "https://marketapi.1688sup.com" //正式
//api全局封装
const req = (method_type, url, params) => {
const http = uni.request({
url,
method: method_type,
data: params
})
return http.then((res) => res[1].data).catch((err) => {})
}
//获取订单详情
export const getInfo = (parmas) => {
return req("post", baseUrl + "/wechat/cash/orderInfo", parmas)
}
//领取红包
export const receiveRed = (parmas) => {
return req("post", baseUrl + "/wechat/cash/receive", parmas)
}
// 是否升级
export const upgrade = () => {
return req("get", baseUrl + "/conf/apiStatus")
}

63
components/notice.vue Normal file
View File

@ -0,0 +1,63 @@
<template>
<div class="mask" @touchmove.prevent @mousewheel.prevent v-if="notice">
<div class="box">
<p class="text">
{{ notice }}
</p>
</div>
</div>
</template>
<script>
export default {
props: {
notice: {
type: String,
default: null
}
}
};
</script>
<style>
.mask {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
background: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: 999;
right: 0;
}
.text {
height: 100rpx;
font-size: 36rpx;
color: #524d4d;
padding: 0 20rpx;
display: flex;
align-items: center;
justify-content: center;
}
.title {
font-size: 50rpx;
font-weight: bold;
color: #171717;
}
.box {
width: 550rpx;
height: 300rpx;
background: #ffffff;
border-radius: 30rpx;
margin-top: -355rpx;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
</style>

20
index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>

21
main.js Normal file
View File

@ -0,0 +1,21 @@
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif

72
manifest.json Normal file
View File

@ -0,0 +1,72 @@
{
"name" : "WX-welfareOfficer",
"appid" : "__UNI__66611EE",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* */
"modules" : {},
/* */
"distribute" : {
/* android */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {}
}
},
/* */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "2"
}

3
package.json Normal file
View File

@ -0,0 +1,3 @@
{
"dependencies": {}
}

17
pages.json Normal file
View File

@ -0,0 +1,17 @@
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "现金红包"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
}

293
pages/index/index.vue Normal file
View File

@ -0,0 +1,293 @@
<template>
<view class="redPackets">
<view class="redPackets-box" @tap="getAuthCode()" v-show="!isOpen">
<view class="top-box">
<text class="title">{{ info.batch_goods_name }}</text>
<text class="type">
{{ info.cash_amount_type_text }}
</text>
</view>
<text class="time">红包有效期截止 {{ info.end_time }}</text>
</view>
<view class="open-redPackets-box" v-show="isOpen">
<view class="open-top-box">
<view class="open-title">
<text class="open-tag"></text>
{{ info.receive_price }}
</view>
<text class="open-type">
{{ info.wishing }}
</text>
</view>
<view class="open-notis" v-if="info.receive_status === 5">
<view class="re"> 领取成功 </view>
请前往微信我的 - 服务 - 钱包 - 账单中查看
</view>
<view class="open-notis" v-else>
<view class="re res"> 已被领取 </view>
</view>
</view>
<noticeBox :notice="notice" />
</view>
</template>
<script>
import { getInfo, receiveRed, upgrade } from "@/api/index.js"
import noticeBox from "@/components/notice.vue"
import { decode } from "@/utils/base64.js"
export default {
components: {
noticeBox
},
data() {
return {
isOpen: false,
order_number: "",
info: {
batch_goods_name: "现金红包",
cash_amount_type_text: "固额红包",
end_time: "2023-06-30 23:59:59",
receive_price: 0.01,
receive_status: 0,
wishing: "恭喜发财"
},
auth_code: "",
notice: null
}
},
async onShow() {
/* 判断是否升级 */
const res = await upgrade()
if (res.data.update) {
return (this.notice = res.data.msg)
}
let option = uni.getEnterOptionsSync().query /*小程序热启用和冷启用取参*/
/* 直接通过小程序打开,判断是否有 order_number */
if (option && option.order_number) {
this.order_number = decode(option.order_number)
} else {
const value = uni.getStorageSync("order_number")
value && (this.order_number = value)
}
this.getRedInfo()
},
methods: {
/* 授权 */
getAuthCode() {
const _this = this
uni.login({
provider: "weixin",
success(data) {
_this.auth_code = data.code
_this.receive()
}
})
},
//
getRedInfo() {
if (!this.order_number) return
uni.showLoading({
mask: true,
title: "加载中"
})
getInfo({
order_number: this.order_number
}).then(({ code, data, message }) => {
if (code == 200) {
uni.setStorageSync("order_number", this.order_number)
uni.hideLoading()
this.info = data
/*0 未领取 1 2 领取成功 3领取失败 */
if ([1, 2].includes(data.receive_status)) {
this.isOpen = true
}
if (data.receive_status === 3) {
uni.showModal({
title: "温馨提示",
showCancel: false,
content: message
})
}
} else {
uni.showModal({
title: "温馨提示",
showCancel: false,
content: message
})
}
})
},
/* 领取红包 */
receive() {
if (this.order_number && this.info.receive_status === 0) {
uni.showLoading({
mask: true,
title: "加载中"
})
receiveRed({
order_number: this.order_number,
auth_code: this.auth_code
}).then(({ code, message }) => {
uni.hideLoading()
if (code === 200) {
this.info.receive_status = 5
this.isOpen = true
uni.showModal({
title: "温馨提示",
showCancel: false,
content: message
})
} else {
uni.showModal({
title: "温馨提示",
showCancel: false,
content: message
})
}
})
} else {
this.isOpen = true
}
}
}
}
</script>
<style>
.redPackets {
height: 100%;
width: 100%;
padding: 50rpx;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
background: url("https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/redPacktes/redPackets_bg.png")
no-repeat;
background-size: 100% 100%;
}
.res {
font-size: 40rpx !important;
}
.redPackets-box {
height: 740rpx;
width: 532rpx;
background-image: url("https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/redPacktes/notOpen.png");
background-repeat: no-repeat;
background-size: contain;
padding-top: 190rpx;
padding-bottom: 50rpx;
margin-top: -120rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
/* border: 1rpx solid; */
}
.top-box {
display: flex;
flex-direction: column;
align-items: center;
}
.title {
font-size: 46rpx;
color: rgb(254, 244, 217);
display: inline-block;
font-weight: bold;
text-shadow: 0.1rpx 0.1rpx rgb(255, 249, 232);
}
.type {
display: block;
padding: 10rpx 46rpx;
border: 1rpx solid rgb(254, 244, 217);
transform: rotateZ(360deg);
border-radius: 50rpx;
font-size: 22rpx;
margin-top: 24rpx;
color: rgb(254, 244, 217);
}
.time {
display: inline-block;
font-size: 22rpx;
color: rgb(249, 181, 134);
}
/* */
.open-redPackets-box {
height: 800rpx;
width: 580rpx;
background-image: url("https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/redPacktes/open.png");
background-repeat: no-repeat;
background-size: contain;
padding-top: 165rpx;
padding-bottom: 110rpx;
margin-top: -75rpx;
margin-left: -46rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
/* border: 1rpx solid; */
}
.open-top-box {
display: flex;
flex-direction: column;
align-items: center;
margin-left: 35rpx;
}
.open-title {
font-size: 90rpx;
color: rgb(245, 72, 54);
display: inline-block;
font-weight: bold;
text-shadow: 0.1rpx 0.1rpx rgb(255, 249, 232);
}
.open-tag {
font-size: 30rpx;
}
.open-type {
display: inline-block;
font-size: 20rpx;
color: rgb(245, 72, 54);
width: 400rpx;
text-align: center;
margin-top: 10rpx;
/* 这里是超出几行省略 */
}
.open-time {
display: inline-block;
font-size: 22rpx;
color: rgb(249, 181, 134);
}
.open-notis {
color: rgb(254, 244, 217);
font-size: 22rpx;
margin-left: 35rpx;
margin-bottom: 70rpx;
}
.re {
text-align: center;
font-size: 26rpx;
margin-bottom: 20rpx;
}
</style>

BIN
static/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

76
uni.scss Normal file
View File

@ -0,0 +1,76 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
/* 文字基本颜色 */
$uni-text-color:#333;//基本色
$uni-text-color-inverse:#fff;//反色
$uni-text-color-grey:#999;//辅助灰色如加载更多的提示信息
$uni-text-color-placeholder: #808080;
$uni-text-color-disable:#c0c0c0;
/* 背景颜色 */
$uni-bg-color:#ffffff;
$uni-bg-color-grey:#f8f8f8;
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
/* 边框颜色 */
$uni-border-color:#c8c7cc;
/* 尺寸变量 */
/* 文字尺寸 */
$uni-font-size-sm:12px;
$uni-font-size-base:14px;
$uni-font-size-lg:16;
/* 图片尺寸 */
$uni-img-size-sm:20px;
$uni-img-size-base:26px;
$uni-img-size-lg:40px;
/* Border Radius */
$uni-border-radius-sm: 2px;
$uni-border-radius-base: 3px;
$uni-border-radius-lg: 6px;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 5px;
$uni-spacing-row-base: 10px;
$uni-spacing-row-lg: 15px;
/* 垂直间距 */
$uni-spacing-col-sm: 4px;
$uni-spacing-col-base: 8px;
$uni-spacing-col-lg: 12px;
/* 透明度 */
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */
$uni-color-title: #2C405A; // 文章标题颜色
$uni-font-size-title:20px;
$uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:26px;
$uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:15px;

87
utils/base64.js Normal file
View File

@ -0,0 +1,87 @@
function encode(str) { // 编码配合encodeURIComponent使用
var c1, c2, c3;
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var i = 0,
len = str.length,
strin = '';
while (i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if (i == len) {
strin += base64EncodeChars.charAt(c1 >> 2);
strin += base64EncodeChars.charAt((c1 & 0x3) << 4);
strin += "==";
break;
}
c2 = str.charCodeAt(i++);
if (i == len) {
strin += base64EncodeChars.charAt(c1 >> 2);
strin += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
strin += base64EncodeChars.charAt((c2 & 0xF) << 2);
strin += "=";
break;
}
c3 = str.charCodeAt(i++);
strin += base64EncodeChars.charAt(c1 >> 2);
strin += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
strin += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
strin += base64EncodeChars.charAt(c3 & 0x3F)
}
return strin
}
function decode(input) { // 解码配合decodeURIComponent使用
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = base64EncodeChars.indexOf(input.charAt(i++));
enc2 = base64EncodeChars.indexOf(input.charAt(i++));
enc3 = base64EncodeChars.indexOf(input.charAt(i++));
enc4 = base64EncodeChars.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
return utf8_decode(output);
}
function utf8_decode(utftext) { // utf-8解码
var string = '';
let i = 0;
let c = 0;
let c1 = 0;
let c2 = 0;
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if ((c > 191) && (c < 224)) {
c1 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c1 & 63));
i += 2;
} else {
c1 = utftext.charCodeAt(i + 1);
c2 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c1 & 63) << 6) | (c2 & 63));
i += 3;
}
}
return string;
}
export {
encode,
decode,
}

4
yarn.lock Normal file
View File

@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1