提交 b5a47407 编写于 作者: DCloud_JSON's avatar DCloud_JSON

1.H5端新增,强制要求用户同意隐私协议 2.兼容ios端自动设置打开下载页用户的剪切板为邀请者的inviteCode 3.成功注册用户,且请求体含邀请码inviteCode自动关联裂变关系

上级 d74e48f9
......@@ -11,7 +11,11 @@
console.log('App Launch')
initApp();
// #ifdef APP-PLUS
//checkIsAgree(); 暂时先用默认生成的,自定义的等待原生支持后实现。因为启动vue界面时已经,请求了部分权限这并不符合国家的法规
//checkIsAgree(); APP端暂时先用原生默认生成的。目前,自定义方式启动vue界面时,原生层已经请求了部分权限这并不符合国家的法规
// #endif
// #ifdef H5
checkIsAgree();
// #endif
// #ifdef APP-PLUS
......
## 1.0.20(2021-06-18)
1.H5端新增,强制要求用户同意隐私协议 2.兼容ios端自动设置打开下载页用户的剪切板为邀请者的inviteCode 3.成功注册用户,且请求体含邀请码inviteCode自动关联裂变关系
## 1.0.19(2021-06-17)
1.新增获取邀请码接口getUserInviteCode 2.在邀请用户下载应用页面,自动设置被邀请用户的剪切板为邀请者的code(仅支持安卓端) 3.在注册或登陆并注册请求时自动添加剪切板中的请求参数 4.统一接口名称为驼峰法
## 1.0.18(2021-06-15)
......
{
"id": "uni-starter",
"displayName": "uni-starter",
"version": "1.0.19",
"version": "1.0.20",
"description": "云端一体应用快速开发基本项目模版",
"keywords": [
"uni-starter",
......
<template>
<view>
<web-view :src="url"></web-view>
</view>
</template>
<script>
export default {
created() {
<template>
<view class="about">
<view class="box">
<image class="logoImg" :src="about.logo"></image>
<text class="tip appName">{{about.appName}}</text>
<text class="tip">{{about.slogan}}</text>
<view @click="download" type="default" id="download">
<image v-if="isIos" class="icon" src="@/static/h5/download-app/ios.png" mode="widthFix"></image>
<image v-else class="icon" src="@/static/h5/download-app/android.png" mode="widthFix"></image>
<text class="download-text">下载</text>
</view>
<text class="tip">version {{about.version}}</text>
</view>
<view class="copyright">
<text class="hint">{{about.company}}</text>
</view>
<view class="mask" v-if="showMask">
<image src="../../../static/h5/download-app/openImg.png" mode="widthFix"></image>
</view>
</view>
</template>
<script>
export default {
computed:{
uniStarterConfig(){
return getApp().globalData.config
}
},
data() {
return {
about:{},
code:"",
isIos:"",
showMask:false,
downloadUrl:{
"ios":"",
"android":""
}
};
},
created() {
this.about = this.uniStarterConfig.about
this.downloadUrl = this.uniStarterConfig.download
this.year = (new Date).getFullYear()
//判断是否在微信中打开
var userAgent = navigator.userAgent;
var ua = userAgent.toLowerCase();
this.isWeixin = ua.indexOf('micromessenger') != -1;
if( this.isWeixin ){
//执行逻辑
}else{
//执行逻辑
}
//判断是否在ios或者安卓打开
this.isIos = !!userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
},
onLoad({code}) {
this.code = code||'123456'
document.getElementById("openApp").style.display = 'none'
document.getElementsByTagName("body")[0].style = ""
},
onLoad({
code
}) {
this.code = code
},
onReady() {
var IframeOnClick = {
resolution: 200,
iframes: [],
interval: null,
Iframe: function() {
this.element = arguments[0];
this.cb = arguments[1];
this.hasTracked = false;
},
track: function(element, cb) {
this.iframes.push(new this.Iframe(element, cb));
if (!this.interval) {
var _this = this;
this.interval = setInterval(function() { _this.checkClick(); }, this.resolution);
}
},
checkClick: function() {
if (document.activeElement) {
var activeElement = document.activeElement;
for (var i in this.iframes) {
if (activeElement === this.iframes[i].element) { // user is in this Iframe
if (this.iframes[i].hasTracked == false) {
this.iframes[i].cb.apply(window, []);
this.iframes[i].hasTracked = true;
}
} else {
this.iframes[i].hasTracked = false;
}
}
}
}
};
IframeOnClick.track(document.getElementsByTagName("iframe")[0], ()=>{
this.copy()
});
},
computed: {
url() {
return getApp().globalData.config.about.download
}
},
data() {
return {
code: ""
}
},
methods: {
copy() {
console.log('copy');
if(!this.code){
return false
}
uni.setClipboardData({
data: 'uniInvitationCode:' + this.code,
success: () => {
uni.showModal({
content: '成功在用户剪切板中存储,邀请人code:'+this.code,
showCancel: false
});
},
fail: () => {
uni.showModal({
content: '失败,未能。在用户剪切板中存储,邀请人code',
showCancel: false
});
}
})
uni.hideToast()
methods:{
download(){
if(this.code){
uni.setClipboardData({
data:this.code,
complete: (e) => {
console.log(e);
// uni.showToast({
// title: JSON.stringify(e),
// icon: 'none'
// });
/* 以下临时解决setClipboardData h5端样式和键盘弹出端错误解决方案,后续会直接内置*/
document.getElementById("#clipboard").style.top = '-999px';
uni.hideKeyboard()
}
})
}
/* 以下临时解决h5端样式和键盘弹出端错误解决方案,后续会直接内置*/
document.getElementById("#clipboard").style.top = '-999px';
uni.hideKeyboard()
}
}
}
</script>
<style>
</style>
if(this.isIos){
window.location.href = this.downloadUrl.ios
}else{
if(this.isWeixin){
//显示浮层
this.showMask = true
}else{
window.location.href = this.downloadUrl.android
}
}
}
}
}
</script>
<style lang="scss">
.about {
width: 750rpx;
flex-direction: column;
}
.box {
margin-top: 100px;
flex-direction: column;
justify-content: center;
align-items: center;
}
.logoImg{
margin-bottom: 10upx;
width:160upx;
height:160upx;
border-radius: 15px;
}
.tip{
font-size:24rpx;
margin-top: 10px;
}
.appName{
margin-top: 20px;
font-size:42rpx;
font-weight: 500;
}
.copyright {
width: 750upx;
font-size:32rpx;
flex-direction: column;
justify-content: center;
align-items: center;
bottom:20px;
left: 0;
position: fixed;
}
.hint {
color:#999999;
font-size:26rpx;
}
.icon{
width: 34rpx;
}
#download{
background-color: #2A9839;
color: #FFFFFF;
margin: 55rpx;
padding: 5px;
width: 200rpx;
border-radius: 100px;
flex-direction: row;
align-items: center;
justify-content: center;
}
.download-text{
font-size: 32rpx;
}
.mask{
position: fixed;
top: 0;
left: 0;
width: 750rpx;
height: 100vh;
flex-direction: row;
justify-content: flex-end;
background-color: rgba(0,0,0,0.6);
}
.mask image{
width: 600rpx;
}
</style>
\ No newline at end of file
......@@ -54,7 +54,13 @@ module.exports = {
}
],
//应用的链接,用于分享到第三方平台和生成关于我们页的二维码
"download": "https://m3w.cn/uniapp"
"download": "https://m3w.cn/uniapp",
//version
"version":"1.0.0" //用于非app端显示,app端自动获取
},
"download":{ //用于生成二合一下载页面
"ios":"https://itunes.apple.com/cn/app/hello-uni-app/id1417078253?mt=8",
"android":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-97fca9f2-41f6-449f-a35e-3f135d4c3875/6d754387-a6c3-48ed-8ad2-e8f39b40fc01.apk"
},
//用于打开应用市场评分界面
"marketId":{
......
......@@ -21,7 +21,8 @@ exports.main = async (event, context) => {
*/
const {
action,
uniIdToken
uniIdToken,
inviteCode
} = event;
const deviceInfo = event.deviceInfo || {};
let params = event.params || {};
......@@ -71,7 +72,11 @@ exports.main = async (event, context) => {
}
//3.注册成功后创建新用户的积分表方法
async function registerSuccess(uid) {
async function registerSuccess(uid) {
//用户接受邀请
if(inviteCode){
await uniID.acceptInvite({inviteCode,uid});
}
//添加当前用户设备信息
await db.collection('uni-id-device').add({
...deviceInfo,
......@@ -154,7 +159,7 @@ exports.main = async (event, context) => {
// console.log(res);
break;
case 'register':
var {username, password, nickname,inviteCode} = params
var {username, password, nickname} = params
if (/^1\d{10}$/.test(username)) {
return {
code: 401,
......@@ -216,12 +221,7 @@ exports.main = async (event, context) => {
res.needCaptcha = needCaptcha;
break;
case 'loginByWeixin':
var {
username, password, nickname
} = params
res = await uniID.loginByWeixin({
...params
});
res = await uniID.loginByWeixin(params);
await uniID.updateUser({
uid: res.uid,
username: "微信用户"
......@@ -293,18 +293,6 @@ exports.main = async (event, context) => {
res = await uniID.loginBySms(params)
await loginLog(res)
break;
case 'inviteLogin':
if (!params.code) {
return {
code: 500,
msg: '请填写验证码'
}
}
res = await uniID.loginBySms({
...params,
type: 'register'
})
break;
case 'resetPwdBySmsCode':
if (!params.code) {
return {
......@@ -343,10 +331,7 @@ exports.main = async (event, context) => {
res = await uniID.getInvitedUser(params)
break;
case 'updatePwd':
res = await uniID.updatePwd({
uid: params.uid,
...params
})
res = await uniID.updatePwd(params)
break;
case 'createCaptcha':
res = await uniCaptcha.create(params)
......@@ -392,7 +377,7 @@ exports.main = async (event, context) => {
const {
userInfo
} = await uniID.getUserInfo({
uid: params.uid,
uid: params.uid
})
if (userInfo.role.indexOf('admin') === -1 && params.role.indexOf('admin') > -1) {
res = {
......
......@@ -69,7 +69,22 @@ import {about} from '@/uni-starter.config.js';
}, 100)
},
disagree() {
plus.runtime.quit();
// #ifdef APP-PLUS
plus.runtime.quit();
// #endif
// #ifdef H5
uni.showModal({
content: '确定退出本应用?',
cancelText:"退出",
confirmText:"取消",
success: (e) => {
if(!e.confirm){
window.location.href="about:blank";
window.close();
}
}
});
// #endif
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册