first commit
This commit is contained in:
21
common/index.scss
Normal file
21
common/index.scss
Normal file
@@ -0,0 +1,21 @@
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
page {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
.p30 {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
.mt10 {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.flex-acsb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex1 {
|
||||
flex: 1;
|
||||
}
|
||||
122
common/js/user.js
Normal file
122
common/js/user.js
Normal file
@@ -0,0 +1,122 @@
|
||||
import {
|
||||
loginApi,
|
||||
loginCodeApi,
|
||||
loginByZfbCode
|
||||
} from "@/api/api.js"
|
||||
import {
|
||||
init
|
||||
} from '@/utils/sok.js';
|
||||
|
||||
|
||||
export const login = async (params, type = 1) => {
|
||||
if (type == 1) {
|
||||
var {
|
||||
code: loginCode
|
||||
} = await uni.login({
|
||||
provider: 'weixin'
|
||||
});
|
||||
try {
|
||||
let {
|
||||
token,
|
||||
userInfo
|
||||
} = await loginCodeApi({
|
||||
loginCode
|
||||
})
|
||||
uni.setStorageSync('token', token);
|
||||
uni.setStorageSync('user', userInfo);
|
||||
uni.setStorageSync('isInvest', false);
|
||||
} catch (err) {
|
||||
if (err.code == 10) {
|
||||
uni.setStorageSync('token', false);
|
||||
}
|
||||
}
|
||||
} else if (type == 2) {
|
||||
|
||||
|
||||
|
||||
var {
|
||||
code: phoneCode
|
||||
} = params.detail;
|
||||
var {
|
||||
code: loginCode
|
||||
} = await uni.login({
|
||||
provider: 'alipay'
|
||||
});
|
||||
try {
|
||||
// #ifdef MP-WEIXIN
|
||||
let {
|
||||
token,
|
||||
user
|
||||
} = await loginApi({
|
||||
phoneCode,
|
||||
loginCode
|
||||
});
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
let {
|
||||
token,
|
||||
user
|
||||
} = await loginByZfbCode({
|
||||
phoneCode,
|
||||
loginCode
|
||||
});
|
||||
// #endif
|
||||
|
||||
|
||||
uni.setStorageSync('token', token);
|
||||
uni.setStorageSync('user', user);
|
||||
uni.setStorageSync('isInvest', false);
|
||||
|
||||
uni.reLaunch({
|
||||
url: '/pages/home/home'
|
||||
});
|
||||
|
||||
// uni.navigateBack()
|
||||
// uni.navigateBack()
|
||||
init()
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const download = (e, type) => {
|
||||
const base64 = uni.arrayBufferToBase64(e.data);
|
||||
const fs = wx.getFileSystemManager()
|
||||
var imgPath = ''11
|
||||
if (type == 'video') {
|
||||
imgPath = wx.env.USER_DATA_PATH + '/base64Video' + '.mp4' //自定义下载图片的名称
|
||||
} else {
|
||||
imgPath = wx.env.USER_DATA_PATH + '/base64img' + '.png' //自定义下载图片的名称
|
||||
}
|
||||
fs.writeFile({
|
||||
filePath: imgPath, //设置下载图片的地址
|
||||
data: base64, //slice(22)的目的是去掉data:image/png;base64,如果本身就不带的话,就直接this.data.codeImg就好了
|
||||
encoding: 'base64',
|
||||
success: function(res) {
|
||||
//读取文件
|
||||
wx.getImageInfo({
|
||||
src: imgPath,
|
||||
success: function(ret) {
|
||||
console.log("请求到了");
|
||||
var path = ret.path;
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: imgPath, //设置下载图片的地址
|
||||
success(result) {
|
||||
console.log("保存成功"); //保存成功
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
// console.log(res);
|
||||
// console.log("请求到了");
|
||||
// wx.saveImageToPhotosAlbum({
|
||||
// filePath: imgPath, //设置下载图片的地址
|
||||
// success: function() {
|
||||
// console.log("保存成功"); //保存成功
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
}
|
||||
105
common/money.json
Normal file
105
common/money.json
Normal file
@@ -0,0 +1,105 @@
|
||||
[{
|
||||
"name": "充值",
|
||||
"id": 1100
|
||||
},
|
||||
{
|
||||
"name": "后台充值",
|
||||
"id": 1200
|
||||
},
|
||||
{
|
||||
"name": "后台划扣",
|
||||
"id": 1201
|
||||
},
|
||||
{
|
||||
"name": "购买商品",
|
||||
"id": 2100
|
||||
},
|
||||
{
|
||||
"name": "商品推广",
|
||||
"id": 2110
|
||||
},
|
||||
{
|
||||
"name": "商品培育津贴",
|
||||
"id": 2120
|
||||
},
|
||||
{
|
||||
"name": "商品服务津贴",
|
||||
"id": 2130
|
||||
},
|
||||
{
|
||||
"name": "购买商品-退单",
|
||||
"id": 2200
|
||||
},
|
||||
{
|
||||
"name": "商品推广-退单",
|
||||
"id": 2210
|
||||
},
|
||||
{
|
||||
"name": "商品培育津贴-退单",
|
||||
"id": 2220
|
||||
},
|
||||
{
|
||||
"name": "商品服务津贴-退单",
|
||||
"id": 2230
|
||||
},
|
||||
{
|
||||
"name": "充电桩收益",
|
||||
"id": 3100
|
||||
},
|
||||
{
|
||||
"name": "充电桩推广",
|
||||
"id": 3110
|
||||
},
|
||||
{
|
||||
"name": "充电桩培育津贴",
|
||||
"id": 3120
|
||||
},
|
||||
{
|
||||
"name": "充电桩服务津贴",
|
||||
"id": 3130
|
||||
},
|
||||
{
|
||||
"name": "充电桩收益-退单",
|
||||
"id": 3200
|
||||
},
|
||||
{
|
||||
"name": "充电桩推广-退单",
|
||||
"id": 3210
|
||||
},
|
||||
{
|
||||
"name": "充电桩培育津贴-退单",
|
||||
"id": 3220
|
||||
},
|
||||
{
|
||||
"name": "充电桩服务津贴-退单",
|
||||
"id": 3230
|
||||
},
|
||||
{
|
||||
"name": "提现",
|
||||
"id": 4100
|
||||
},
|
||||
{
|
||||
"name": "提现失败",
|
||||
"id": 4200
|
||||
},
|
||||
{
|
||||
"name": "转赠付款",
|
||||
"id": 5100
|
||||
},
|
||||
{
|
||||
"name": "转赠收款",
|
||||
"id": 5200
|
||||
},
|
||||
{
|
||||
"name": "转换减少",
|
||||
"id": 6100
|
||||
},
|
||||
{
|
||||
"name": "转换增加",
|
||||
"id": 6200
|
||||
},
|
||||
{
|
||||
"name": "转账-星梦",
|
||||
"id": 7100
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user