Commit 52a15d32 authored by 不吃草的咩's avatar 不吃草的咩

增加微信支付

parent 8ee29e44
......@@ -12,8 +12,8 @@ export const colorUISdk = new ColorUISdk({
},
//开发环境
dev: {
url: 'http://192.168.15.249:8050/'
// url:'http://jbzhang.censoft.com.cn/'
// url: 'http://101.42.222.235:8050/'
url:'http://jbzhang.censoft.com.cn/'
},
//本地环境
host: {
......
......@@ -14,52 +14,52 @@ Page({
onReady() {
listItem = [
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
}
......
......@@ -6,52 +6,52 @@ Page({
onLoad() {
let listItem = [
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
},
{
'image': 'http://192.168.15.249/static/img/big39000.jpg',
'image': 'http://101.42.222.235/static/img/big39000.jpg',
'title': '虚拟列表滚动,虚拟列表滚动,虚拟列表滚动.',
'passtime': '2021-02-02 10:00:51'
}
......
......@@ -9,7 +9,7 @@
<view style="{{'width:'+ (sys_capsule.width + 10)+'px; height:'+sys_capsule.height+'px'}}"/>
</view>
</ui-navbar>
<image src="http://192.168.15.249/static/img/Yw4LMx.png" mode="widthFix" class="w-100"/>
<image src="http://101.42.222.235/static/img/Yw4LMx.png" mode="widthFix" class="w-100"/>
<view class="ui-container">
<ui-title title="定制服务" depth="2" isIcon/>
......
......@@ -2,21 +2,21 @@ Page({
data: {
shop: [{
title: 'ColorUI-卡片',
imgUrl: 'http://192.168.15.249/static/img/big39000.jpg',
avatar: 'http://192.168.15.249/static/img/big39000.jpg',
imgUrl: 'http://101.42.222.235/static/img/big39000.jpg',
avatar: 'http://101.42.222.235/static/img/big39000.jpg',
name: '盒子芥末',
isFavor: false,
favor: 333
}, {
title: 'ColorUI-卡片,ColorUI-卡片',
imgUrl: 'http://192.168.15.249/static/img/big39000.jpg',
avatar: 'http://192.168.15.249/static/img/big39000.jpg',
imgUrl: 'http://101.42.222.235/static/img/big39000.jpg',
avatar: 'http://101.42.222.235/static/img/big39000.jpg',
name: '盒子芥末',
isFavor: true,
favor: 333
}],
list: [{
img: 'http://192.168.15.249/static/img/big39000.jpg',
img: 'http://101.42.222.235/static/img/big39000.jpg',
title: 'ColorStore - 个人小店',
desc: '个人开店首选!有分类,有物流。包含多种活动,优惠券页面。',
price: '799',
......@@ -24,7 +24,7 @@ Page({
comment: 55
},
{
img: 'http://192.168.15.249/static/img/big39000.jpg',
img: 'http://101.42.222.235/static/img/big39000.jpg',
title: 'ColorShop',
desc: '适配多语言,会员、商家多用户角色。对接国际物流,跨境电商立马搞定!',
price: '2799',
......@@ -32,7 +32,7 @@ Page({
comment: 24
},
{
img: 'http://192.168.15.249/static/img/big39000.jpg',
img: 'http://101.42.222.235/static/img/big39000.jpg',
title: 'ColorTakeaway',
desc: '多商家,多用户,另有骑手端。可做区域配送。',
price: '4799',
......@@ -40,7 +40,7 @@ Page({
comment: 32
},
{
img: 'http://192.168.15.249/static/img/big39000.jpg',
img: 'http://101.42.222.235/static/img/big39000.jpg',
title: 'ColorFinance',
desc: ' ',
price: '4799',
......
......@@ -5,7 +5,7 @@
<block wx:if="{{isSlot}}">
<view class="flex-bar p-3" wx:if="{{scrollTop > sys_navBar}}">
<image src="http://192.168.15.249/static/img/hapm8.png" mode="aspectFill" style="width: 200rpx;height: 56rpx;"/>
<image src="http://101.42.222.235/static/img/hapm8.png" mode="aspectFill" style="width: 200rpx;height: 56rpx;"/>
</view>
<view class="p-3 flex-bar flex-sub" wx:if="{{scrollTop > sys_navBar}}">
<view url="/pages/search/search" class="flex-sub flex-bar">
......
......@@ -10,7 +10,7 @@ Page({
if (e.detail) {
title = '';
bg = 'bg-img';
bgImg = 'http://192.168.15.249/static/img/4put2.png';
bgImg = 'http://101.42.222.235/static/img/4put2.png';
}
this.setData({
isBg: e.detail,
......
......@@ -9,12 +9,12 @@ Page({
scrollTop: 0,
swiperList: [
{
img: "http://192.168.15.249/static/img/45fc.png",
img: "http://101.42.222.235/static/img/45fc.png",
url: '/pages/document/qyDetail/qyDetail?type=0',
type: 'navigateTo' //直接跳转类型
},
{
img: "http://192.168.15.249/static/img/d0f2.png" ,
img: "http://101.42.222.235/static/img/d0f2.png" ,
url: '/pages/document/qyDetail/qyDetail?type=1',
type: 'navigateTo' //直接跳转类型
},
......
<ui-sys img="http://192.168.15.249/static/img/4put2.png" tabbar>
<ui-sys img="http://101.42.222.235/static/img/4put2.png" tabbar>
<ui-navbar back="{{false}}" isSlot opacity scrollTop="{{scrollTop}}">
<view class="flex-bar p-3" wx:if="{{scrollTop > sys_navBar}}" style="padding-top:0px !important;">
......
......@@ -3,83 +3,142 @@ import Toast from '../../vantPackage/toast/toast';
Page({
data: {
scrollTop: 0,
show:false,
title:'登录,享受更多服务。'
show: false,
title: '登录,享受更多服务。'
},
tapToUrl() {
// wx.navigateTo({
// url: e.currentTarget.dataset.url
// })
let token = wx.getStorageSync('token');
if(token == ''){
if (token == '') {
this.setData({
show:true
show: true
})
};
},
randomWord(randomFlag, min, max){
randomWord(randomFlag, min, max) {
let str = "",
range = min,
arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
// 随机产生
if(randomFlag){
range = Math.round(Math.random() * (max-min)) + min;
if (randomFlag) {
range = Math.round(Math.random() * (max - min)) + min;
}
for(var i=0; i<range; i++){
let pos = Math.round(Math.random() * (arr.length-1));
for (var i = 0; i < range; i++) {
let pos = Math.round(Math.random() * (arr.length - 1));
str += arr[pos];
}
return str;
},
getPhoneNumber (e) {
getPhoneNumber(e) {
console.log(e);
//如果返回成功手机号,就随机生成一串字符串存进去
if(e.detail.code !== undefined){
console.log(e.detail);
if (e.detail.code !== undefined) {
wx.login({
timeout: 30000,
success:function(res){
console.log(res);
success(res) {
if (res.code) {
app.colorUISdk.request({
url: `wx/getOpenId?code=${res.code}`,
method: 'POST'
}).then(({ data }) => {
console.log(data);
try {
wx.setStorageSync('openid', data.openid);
} catch (e) {
wx.showToast({
title: 'OPENID储存失败!',
icon: 'none'
})
}
}).catch(err => {
console.log(err)
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
})
console.log(e.detail);
app.colorUISdk.request({
url:`wx/gt?code=${e.detail.code}`,
url: `wx/gt?code=${e.detail.code}`,
method: 'POST'
}).then(({data})=> {
}).then(({ data }) => {
console.log(data);
if(data.errcode == 0){
let random = this.randomWord(false, 43);
// let random = Math.random().toString(36).substr(2);
if (data.errcode == 0) {
let random = this.randomWord(false, 43);
// let random = Math.random().toString(36).substr(2);
try {
wx.setStorageSync('token', random+data.phone_info.phoneNumber);
wx.setStorageSync('token', random + data.phone_info.phoneNumber);
app.phone = data.phone_info.phoneNumber;
Toast.success('登录成功');
this.setData({
show:false,
title:data.phone_info.phoneNumber,
show: false,
title: data.phone_info.phoneNumber,
})
} catch (e) {
} catch (e) {
wx.showToast({
title: '数据存储失败!',
icon: 'none'
})
}
}
}
this.setData({courseData: res.data.records})
}).catch(err=>{
this.setData({ courseData: res.data.records })
}).catch(err => {
console.log(err)
})
}else{
} else {
wx.showToast({
title: '授权失败,请您重新登录!',
icon: 'none'
})
}
},
onClose(){
payOrder(){
var openid = wx.getStorageSync('openid');
app.colorUISdk.request({
url: `wx/pay_one?openid=${openid}`,
method: 'POST'
}).then(({ prepay_info,sign_info }) => {
console.log(prepay_info);
console.log(sign_info);
wx.requestPayment
(
{
"timeStamp": sign_info.timeStamp,
"nonceStr": sign_info.nonceStr,
"package": sign_info.package,
"signType": "RSA",
"paySign": sign_info.paySign,
"success":function(res){
console.log(res)
},
"fail":function(res){
console.log(res);
},
"complete":function(res){
console.log(res);
}
}
)
}).catch(err => {
console.log(err)
})
},
onClose() {
this.setData({
show:false
show: false
})
},
tapCopy(e) {
......@@ -99,30 +158,30 @@ Page({
},
});
},
mycenter(){
let token = wx.getStorageSync('token'); //是否登录
if(token != ''){
mycenter() {
let token = wx.getStorageSync('token'); //是否登录
if (token != '') {
wx.navigateTo({
url: '/pages/seeSignup/seeSignup',
url: '/pages/seeSignup/seeSignup',
})
}else{
} else {
this.setData({
show:true
show: true
})
}
},
seesign(){
let token = wx.getStorageSync('token'); //是否登录
if(token != ''){
},
seesign() {
let token = wx.getStorageSync('token'); //是否登录
if (token != '') {
wx.navigateTo({
url: '/pages/seeSignup/seeSignup',
url: '/pages/seeSignup/seeSignup',
})
}else{
} else {
this.setData({
show:true
show: true
})
}
},
},
// 监听用户滑动页面事件。
onPageScroll(e) {
// 注意:请只在需要的时候才在 page 中定义此方法,不要定义空方法。以减少不必要的事件派发对渲染层-逻辑层通信的影响。
......@@ -132,11 +191,11 @@ Page({
scrollTop: e.scrollTop
})
},
onShow:function(){
onShow: function () {
let token = wx.getStorageSync('token');
if(token == ''){
if (token == '') {
this.setData({
show:true
show: true
})
}
}
......
<ui-sys img="http://192.168.15.249/static/img/4put2.png" tabbar>
<ui-sys img="http://101.42.222.235/static/img/4put2.png" tabbar>
<ui-navbar back="{{false}}" isSlot opacity scrollTop="{{scrollTop}}">
<view class="flex-center flex-sub" wx:if="{{scrollTop > sys_navBar}}">我的</view>
</ui-navbar>
......@@ -10,6 +10,7 @@
</view>
</view>
<van-cell-group inset>
<van-cell title="报名缴费" isLink bind:click="payOrder"/>
<van-cell title="个人中心" isLink bind:click="mycenter"/>
<van-cell title="我的报名" isLink bind:click="seesign"/>
<van-cell title="设置" isLink url=""/>
......
......@@ -16,7 +16,7 @@
<view style="{{'width:'+ (sys_capsule.width + 10)+'px; height:'+sys_capsule.height+'px'}}"/>
</view>
</ui-navbar>
<image src="http://192.168.15.249/static/img/uqlh4.png" mode="widthFix" class="w-100"/>
<image src="http://101.42.222.235/static/img/uqlh4.png" mode="widthFix" class="w-100"/>
<view class="ui-container">
<ui-title title="热门模板" depth="2" isIcon ui="ml-3"/>
......
......@@ -16,7 +16,7 @@
<view style="{{'width:'+ (sys_capsule.width + 10)+'px; height:'+sys_capsule.height+'px'}}"/>
</view>
</ui-navbar>
<image src="http://192.168.15.249/static/img/ukzmk.png" mode="widthFix" class="w-100"/>
<image src="http://101.42.222.235/static/img/ukzmk.png" mode="widthFix" class="w-100"/>
<view class="page-card-box">
<view class="bg-blue-gradient shadow-blur page-card-view">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment