瀏覽代碼

添加分享功能

dev
corala 3 年之前
父節點
當前提交
b6d31ccb29
共有 11 個文件被更改,包括 221 次插入57 次删除
  1. +6
    -8
      app.js
  2. +1
    -0
      app.json
  3. +5
    -3
      pages/AR/index.js
  4. +11
    -21
      pages/login/index.js
  5. +0
    -6
      pages/login/index.wxml
  6. +1
    -18
      pages/login/index.wxss
  7. +2
    -1
      pages/out/index.json
  8. +101
    -0
      pages/share/index.js
  9. +4
    -0
      pages/share/index.json
  10. +15
    -0
      pages/share/index.wxml
  11. +75
    -0
      pages/share/index.wxss

+ 6
- 8
app.js 查看文件

@@ -1,7 +1,5 @@
// app.js
import './utils/umtrack-wx';
// import "./components/umtrack-wx";
// require('umtrack-wx');
App({
umengConfig: {
appKey: '6260d691d024421570c69177', //由友盟分配的APP_KEY
@@ -20,14 +18,14 @@ App({
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// wx.login({
// success: res => {
// // 发送 res.code 到后台换取 openId, sessionKey, unionId
// }
// })
},
globalData: {
userInfo: null,
token: ''
token: '1212121212'
}
})

+ 1
- 0
app.json 查看文件

@@ -1,6 +1,7 @@
{
"pages": [
"pages/index/index",
"pages/share/index",
"pages/login/index",
"pages/out/index",
"pages/middle/index",


+ 5
- 3
pages/AR/index.js 查看文件

@@ -66,11 +66,15 @@ Page({
console.info(err);
});
},
onHide(){
console.log('tuichu')
clearInterval(timer);
},
daojishi(){
var t = 10;
var timer = setInterval(function(){
t--;
if(t<4){
if(t<2){
wx.showToast({
icon: 'none',
title: '扫描时间过长,请退出后重新扫描!',
@@ -95,9 +99,7 @@ Page({
showLoading: false,
});
},

//图像识别部分:

onShow: function () {
if (this.listener) this.listener.start(); //页面隐藏时相机帧的监听会自动停止,但恢复展示时不会自动启动,这里手动启动
this.scan()


+ 11
- 21
pages/login/index.js 查看文件

@@ -4,8 +4,6 @@ const app = getApp()

Page({
data: {
ischecked: true,
bindInfo: false,
avatarModal: false,
phoneModal: false,
phoneModal1: false,
@@ -25,15 +23,15 @@ Page({
url: '/pages/index/index'
})
},
checkFun(){
this.setData({
ischecked: !this.data.ischecked
})
},
// 协议
toxieyi(){
},
shouquan(){
let userInfo = wx.getStorageSync('userInfo')
if(userInfo.phone){
wx.showToast({
icon: 'none',
title: '您已完成授权',
})
}
if(this.data.step==1){
this.setData({
avatarModal: true,
@@ -54,7 +52,7 @@ Page({
},
leave(){
wx.navigateTo({
url: '../out/index?index=1&userid='+ this.data.userid+'&gameid=1'+'&type=2',
url: '/pages/out/index?index=1&userid='+ this.data.userid+'&gameid=1'+'&type=2',
})
},
//登录-获取token
@@ -80,12 +78,12 @@ Page({
userid: userInfo.id,
userInfo: userInfo
})
wx.setStorageSync('token', res1.data.access_token)
wx.setStorageSync('userInfo', userInfo)
if(!!userInfo.userWxName&&!!userInfo.phone){
that.leave()
return;
}
// console.log(userInfo)
if(!userInfo.userWxName||!userInfo.phone){
that.setData({
showBg: true
@@ -147,14 +145,6 @@ Page({
})
},
getUserInfo(){
// if(!this.data.ischecked){
// wx.showToast({
// title: '请勾选协议',
// icon: 'none',
// duration: 2000
// })
// return;
// }
let that = this
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写


+ 0
- 6
pages/login/index.wxml 查看文件

@@ -5,12 +5,6 @@
<image class="title" src="https://static.quhouse.com/18484fa813a24a64bd007dfca3652379.png"></image>
<image class="search" src="https://static.quhouse.com/72cac48d2d804744bd83a2a882713a6f.png"></image>
<image class="logo" src="https://static.quhouse.com/fecdef9ed6a045aaade3d48980e33a35.png"></image>
<!-- <view class="agreement">
<image class="checked"
wx:if="{{ischecked}}" src="https://static.quhouse.com/4024a0e92b0245a7b14cc5c78cab90f7.png"></image>
<view class="text">勾选表示您已阅读并同意</view>
<view class="text text1">《隐私协议》</view>
</view> -->
<view class="btn" bindtap="shouquan">微信一键授权</view>
<view class="btn btn1" bindtap="backhome">返回游戏</view>
</view>


+ 1
- 18
pages/login/index.wxss 查看文件

@@ -42,24 +42,7 @@
height: 58rpx;
margin-bottom: 42rpx;
}
.agreement{
display: flex;
align-items: center;
justify-content: flex-start;
margin-bottom: 30rpx;
}
.checked{
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.nocheck{
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
border: 2rpx #CE592E solid;
border-radius: 5rpx;
}

.text{
height: 32rpx;
font-size: 24rpx;


+ 2
- 1
pages/out/index.json 查看文件

@@ -1,3 +1,4 @@
{
"usingComponents": {}
"usingComponents": {},
"navigationStyle": "custom"
}

+ 101
- 0
pages/share/index.js 查看文件

@@ -0,0 +1,101 @@
// pages/out/index.js
Page({

/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
backGame(){
wx.navigateBack({
delta: 1
})
// let userInfo = wx.getStorageSync('userInfo')
// wx.navigateTo({
// url: `/pages/out/index?index=1&userid=${userInfo.id}&gameid=1&type=2`,
// })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function (e) {
console.log(e)
this.shareFun()
return {
title: '5.5元购新房万份好礼免费兑',
imageUrl: 'https://static.quhouse.com/468340e3a1374decb4fa51a172aa4f52.png',
path: '/pages/index/index'
}
},
shareFun(){
let token = wx.getStorageSync('token')
wx.request({
url: 'https://cktest.2weisou.com/meta/ar/user/share',
method: "POST",
data: {},
header: {
Authorization: 'bearer '+ token
},
success(res) {
console.log(res)
if (res.data.code == 0) {
}else{
wx.showToast({
icon: 'none',
title: res.data.msg
})
return ;
}
}
})
}
})

+ 4
- 0
pages/share/index.json 查看文件

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationStyle": "custom"
}

+ 15
- 0
pages/share/index.wxml 查看文件

@@ -0,0 +1,15 @@
<view class="container">
<view class="contbox">
<view class="insetbox">
<view class="topcont">
<image class="avatar" src="https://static.quhouse.com/54c0dd0e62d74f7cba9e9cc520a164c1.png"></image>
<view class="title">邀请好友
<view class="text">每邀请1位好友参与游戏,可增加1次游戏机会</view>
</view>
</view>
<!-- <image class="btn" src="https://static.quhouse.com/cbbbda43ce244fe39c235f59c2b1e8fa.png"></image> -->
<button class="btn" open-type="share"></button>
</view>
<image class="close" bindtap="backGame" src="https://static.quhouse.com/643b05904e17410aa568557328cf7dc1.png"></image>
</view>
</view>

+ 75
- 0
pages/share/index.wxss 查看文件

@@ -0,0 +1,75 @@
.container{
background: url('https://static.quhouse.com/7f51a916a2fb4eb983f65295963bddd8.png') no-repeat;
width: 750rpx;
height: 1624rpx;
background-size: 750rpx 1624rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.contbox{
width: 564rpx;
height: 434rpx;
background: #CE592E;
box-shadow: inset 0px 1rpx 3rpx 0px #FFFFFF;
position: relative;
box-sizing: content-box;
border-radius: 100rpx 100rpx 72rpx 72rpx;
display: flex;
align-items: center;
justify-content: center;
}
.insetbox{
width: 538rpx;
height: 402rpx;
background: #F8F8F8;
box-shadow: 0px -1rpx 2rpx 0px #C85931, inset 0px 0px 16rpx 2rpx #CE592E;
border-radius: 100rpx 100rpx 72rpx 72rpx;
border: 1rpx solid #91320F;
}
.close{
position: absolute;
right: 0;
top: -20rpx;
width: 86rpx;
height: 86rpx;
}
.topcont{
display: flex;
margin: 82rpx 0 40rpx 55rpx;
}
.topcont .avatar{
width: 128rpx;
height: 128rpx;
margin-right: 24rpx;
}
.title{
flex:1;
height: 44rpx;
font-size: 32rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #CE592E;
line-height: 44rpx;
}
.title .text{
margin-top: 12rpx;
width:298rpx;
height: 74rpx;
font-size: 26rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #CE592E;
line-height: 37rpx;
}
.insetbox .btn{
width: 280rpx;
height: 92rpx;
margin-left: 130rpx;
background: url('https://static.quhouse.com/cbbbda43ce244fe39c235f59c2b1e8fa.png') no-repeat;
background-size: cover;
padding: 0;
}



Loading…
取消
儲存