绑定极光id
This commit is contained in:
parent
d3bba79eb4
commit
65da47058c
49
App.vue
49
App.vue
@ -124,24 +124,24 @@
|
||||
jpushModule.initJPushService()
|
||||
jpushModule.addConnectEventListener(result=>{
|
||||
let connectEnable = result.connectEnable
|
||||
console.log("jpush连接", connectEnable)
|
||||
// console.log("jpush连接", connectEnable)
|
||||
})
|
||||
|
||||
// 设置别名
|
||||
jpushModule.setAlias({
|
||||
'alias': uni.getStorageSync('userId'),
|
||||
'sequence': 1
|
||||
})
|
||||
// jpushModule.setAlias({
|
||||
// 'alias': uni.getStorageSync('userId'),
|
||||
// 'sequence': 1
|
||||
// })
|
||||
//
|
||||
jpushModule.addTagAliasListener(result => {
|
||||
let code = result.code
|
||||
let sequence = result.sequence
|
||||
let tags = result.tags
|
||||
let tag = result.tag
|
||||
let tagEnable = result.tagEnable
|
||||
let alias = result.alias
|
||||
console.log(alias, '别名')
|
||||
})
|
||||
// jpushModule.addTagAliasListener(result => {
|
||||
// let code = result.code
|
||||
// let sequence = result.sequence
|
||||
// let tags = result.tags
|
||||
// let tag = result.tag
|
||||
// let tagEnable = result.tagEnable
|
||||
// let alias = result.alias
|
||||
// console.log(alias, '别名')
|
||||
// })
|
||||
// 通知事件回调
|
||||
jpushModule.addNotificationListener(result => {
|
||||
let notificationEventType = result.notificationEventType
|
||||
@ -153,22 +153,17 @@
|
||||
// 点击事件
|
||||
if (notificationEventType == 'notificationOpened') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/daibanliebiao/daibanliebiao'
|
||||
url: result.extras.route
|
||||
})
|
||||
}
|
||||
})
|
||||
jpushModule.getRegistrationID(result => {
|
||||
console.log("注册ID", result.registerID)
|
||||
if (result.registerID) {
|
||||
uni.setStorageSync("register_id", result.registerID)
|
||||
}
|
||||
})
|
||||
jpushModule.addCustomMessageListener(result => {
|
||||
let messageID = result.messageID
|
||||
let content = result.content
|
||||
let extras = result.extras
|
||||
console.log("自定义消息", result)
|
||||
})
|
||||
|
||||
// jpushModule.addCustomMessageListener(result => {
|
||||
// let messageID = result.messageID
|
||||
// let content = result.content
|
||||
// let extras = result.extras
|
||||
// console.log("自定义消息", result)
|
||||
// })
|
||||
//#endif
|
||||
|
||||
|
||||
|
@ -74,6 +74,16 @@ export function bindMp(data) {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 绑定极光id
|
||||
* @param data object 小程序用户登陆信息
|
||||
*/
|
||||
export function bindJG(data) {
|
||||
return request.post("auth/bindJg", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享
|
||||
* @returns {*}
|
||||
|
@ -9,7 +9,8 @@
|
||||
</div>
|
||||
<div class="whiteBg" v-if="formItem === 1">
|
||||
<div class="title acea-row row-center-wrapper">
|
||||
<div class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" @click="navTap(index)" :key="index">
|
||||
<div class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
|
||||
@click="navTap(index)" :key="index">
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
@ -18,13 +19,15 @@
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/phone_1.png"></image>
|
||||
<input type="text" placeholder="输入账号" placeholder-class="placeholder" v-model="account" required />
|
||||
<input type="text" placeholder="输入账号" placeholder-class="placeholder"
|
||||
v-model="account" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="password" placeholder="填写登录密码" placeholder-class="placeholder" v-model="password" required />
|
||||
<input type="password" placeholder="填写登录密码" placeholder-class="placeholder"
|
||||
v-model="password" required />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -40,14 +43,17 @@
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/phone_1.png"></image>
|
||||
<input type="text" placeholder="输入手机号码" placeholder-class="placeholder" v-model="account" />
|
||||
<input type="text" placeholder="输入手机号码" placeholder-class="placeholder"
|
||||
v-model="account" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput" v-model="captcha" />
|
||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="handleVerify">
|
||||
<input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput"
|
||||
v-model="captcha" />
|
||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
||||
@click="handleVerify">
|
||||
{{ text }}
|
||||
</button>
|
||||
</div>
|
||||
@ -55,8 +61,11 @@
|
||||
<div class="item" v-if="isShowCode">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput" v-model="codeVal" />
|
||||
<div class="code" @click="getcaptcha"><image class="code-img" style="width: 100%;height: 100%;" :src="codeUrl" /></div>
|
||||
<input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput"
|
||||
v-model="codeVal" />
|
||||
<div class="code" @click="getcaptcha">
|
||||
<image class="code-img" style="width: 100%;height: 100%;" :src="codeUrl" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -66,7 +75,9 @@
|
||||
<div class="protocol acea-row row-between-wrapper">
|
||||
<checkbox-group class="checkgroup" @change='isAgree=!isAgree'>
|
||||
<checkbox class="checkbox" :checked="isAgree ? true : false" />
|
||||
<text class="protocol_text">我已同意<text @click="userAgree" class="font_pro">《用户协议》</text>与<text @click="userPrivacyAgree" class="font_pro">《隐私政策》</text></text>
|
||||
<text class="protocol_text">我已同意<text @click="userAgree"
|
||||
class="font_pro">《用户协议》</text>与<text @click="userPrivacyAgree"
|
||||
class="font_pro">《隐私政策》</text></text>
|
||||
</checkbox-group>
|
||||
</div>
|
||||
<!-- #ifdef MP -->
|
||||
@ -109,14 +120,17 @@
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/phone_1.png"></image>
|
||||
<input type="text" placeholder="输入手机号码" placeholder-class="placeholder" v-model="account" />
|
||||
<input type="text" placeholder="输入手机号码" placeholder-class="placeholder"
|
||||
v-model="account" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput" v-model="captcha" />
|
||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="handleVerify">
|
||||
<input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput"
|
||||
v-model="captcha" />
|
||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
||||
@click="handleVerify">
|
||||
{{ text }}
|
||||
</button>
|
||||
</div>
|
||||
@ -124,14 +138,18 @@
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_1.png"></image>
|
||||
<input type="password" placeholder="填写您的登录密码" placeholder-class="placeholder" v-model="password" />
|
||||
<input type="password" placeholder="填写您的登录密码" placeholder-class="placeholder"
|
||||
v-model="password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" v-if="isShowCode">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput" v-model="codeVal" />
|
||||
<div class="code" @click="getcaptcha"><image class="code-img" style="width: 100%;height: 100%;" :src="codeUrl" /></div>
|
||||
<input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput"
|
||||
v-model="codeVal" />
|
||||
<div class="code" @click="getcaptcha">
|
||||
<image class="code-img" style="width: 100%;height: 100%;" :src="codeUrl" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -145,7 +163,9 @@
|
||||
<div class="protocol acea-row row-between-wrapper">
|
||||
<checkbox-group class="checkgroup" @change='isAgree=!isAgree'>
|
||||
<checkbox class="checkbox" :checked="isAgree ? true : false" />
|
||||
<text class="protocol_text">我已同意<text @click="userAgree" class="font_pro">《用户协议》</text>与<text @click="userPrivacyAgree" class="font_pro">《隐私政策》</text></text>
|
||||
<text class="protocol_text">我已同意<text @click="userAgree"
|
||||
class="font_pro">《用户协议》</text>与<text @click="userPrivacyAgree"
|
||||
class="font_pro">《隐私政策》</text></text>
|
||||
</checkbox-group>
|
||||
</div>
|
||||
|
||||
@ -183,21 +203,27 @@
|
||||
<view class="ChangePassword">
|
||||
<view class="list">
|
||||
<view class="item">
|
||||
<input type='number' placeholder='填写手机号码' placeholder-class='placeholder' v-model="account"></input>
|
||||
<input type='number' placeholder='填写手机号码' placeholder-class='placeholder'
|
||||
v-model="account"></input>
|
||||
</view>
|
||||
<view class="item acea-row row-between-wrapper">
|
||||
<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput" v-model="captcha"></input>
|
||||
<button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="handleVerify">
|
||||
<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput"
|
||||
v-model="captcha"></input>
|
||||
<button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled'
|
||||
@click="handleVerify">
|
||||
{{ text }}
|
||||
</button>
|
||||
</view>
|
||||
<view class="item">
|
||||
<input type='password' placeholder='填写登录密码' placeholder-class='placeholder' v-model="password"></input>
|
||||
<input type='password' placeholder='填写登录密码' placeholder-class='placeholder'
|
||||
v-model="password"></input>
|
||||
</view>
|
||||
<view class="protocol acea-row row-between-wrapper">
|
||||
<checkbox-group class="checkgroup" @change='isAgree=!isAgree'>
|
||||
<checkbox class="checkbox" :checked="isAgree ? true : false" />
|
||||
<text class="protocol_text">我已同意<text @click="userAgree" class="font_pro">《用户协议》</text>与<text @click="userPrivacyAgree" class="font_pro">《隐私政策》</text></text>
|
||||
<text class="protocol_text">我已同意<text @click="userAgree"
|
||||
class="font_pro">《用户协议》</text>与<text @click="userPrivacyAgree"
|
||||
class="font_pro">《隐私政策》</text></text>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
@ -205,9 +231,11 @@
|
||||
<button form-type="submit" @click="auth_token = ''" class="confirmBnt back">返回</button>
|
||||
</view>
|
||||
</form>
|
||||
<view class="copyright" @click="goCopyUrl">{{ copyright.status == -1 ? `${copyright.year} ${copyright.url}` : copyright.Copyright }}</view>
|
||||
<view class="copyright" @click="goCopyUrl">
|
||||
{{ copyright.status == -1 ? `${copyright.year} ${copyright.url}` : copyright.Copyright }}</view>
|
||||
|
||||
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
|
||||
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }"
|
||||
ref="verify"></Verify>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -252,7 +280,8 @@
|
||||
getLogo,
|
||||
getconfig,
|
||||
getVersion,
|
||||
bindMp
|
||||
bindMp,
|
||||
bindJG
|
||||
} from "@/api/public";
|
||||
// import cookie from "@/utils/store/cookie";
|
||||
import {
|
||||
@ -267,6 +296,7 @@
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import Verify from '@/components/verify/verify.vue';
|
||||
var jpushModule = uni.requireNativePlugin("JG-JPush");
|
||||
const BACK_URL = "login_back_url";
|
||||
|
||||
export default {
|
||||
@ -367,7 +397,8 @@
|
||||
that.$store.commit('UPDATE_USERINFO', data.user);
|
||||
|
||||
let method
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart', '/pages/goods_cate/goods_cate',
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart',
|
||||
'/pages/goods_cate/goods_cate',
|
||||
'/pages/user/index', '/pages/plant_grass/index'
|
||||
]
|
||||
if (indexPat.includes(this.getPath(backUrl))) {
|
||||
@ -467,9 +498,11 @@
|
||||
auth: {
|
||||
userInfo: that.appleUserInfo,
|
||||
openId: that.appleUserInfo.openId,
|
||||
nickname: (that.appleUserInfo.fullName.familyName || '') + (that.appleUserInfo.fullName.giveName || ''),
|
||||
nickname: (that.appleUserInfo.fullName.familyName || '') + (that.appleUserInfo.fullName
|
||||
.giveName || ''),
|
||||
}
|
||||
}}).then(res => {
|
||||
}
|
||||
}).then(res => {
|
||||
const data = res.data;
|
||||
if (res.data.status == 200) {
|
||||
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
|
||||
@ -482,7 +515,8 @@
|
||||
that.$store.commit('UPDATE_USERINFO', data.result.user);
|
||||
|
||||
let method
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart', '/pages/goods_cate/goods_cate',
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart',
|
||||
'/pages/goods_cate/goods_cate',
|
||||
'/pages/user/index', '/pages/plant_grass/index'
|
||||
]
|
||||
if (indexPat.includes(this.getPath(backUrl))) {
|
||||
@ -556,7 +590,8 @@
|
||||
openid: that.appUserInfo.authResult.openid,
|
||||
phone: this.account,
|
||||
}
|
||||
}}).then(res => {
|
||||
}
|
||||
}).then(res => {
|
||||
const data = res.data;
|
||||
if (res.data.status == 200) {
|
||||
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
|
||||
@ -568,7 +603,8 @@
|
||||
that.$store.commit("SETUID", data.result.user.uid);
|
||||
that.$store.commit('UPDATE_USERINFO', data.result.user);
|
||||
let method
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart', '/pages/goods_cate/goods_cate',
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart',
|
||||
'/pages/goods_cate/goods_cate',
|
||||
'/pages/user/index', '/pages/plant_grass/index'
|
||||
]
|
||||
if (indexPat.includes(this.getPath(backUrl))) {
|
||||
@ -662,7 +698,8 @@
|
||||
that.$store.commit('UPDATE_USERINFO', data.user);
|
||||
|
||||
let method
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart', '/pages/goods_cate/goods_cate',
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart',
|
||||
'/pages/goods_cate/goods_cate',
|
||||
'/pages/user/index'
|
||||
]
|
||||
if (indexPat.includes(this.getPath(backUrl))) {
|
||||
@ -823,7 +860,8 @@
|
||||
that.$store.commit('UPDATE_USERINFO', data.user);
|
||||
|
||||
let method
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart', '/pages/goods_cate/goods_cate',
|
||||
let indexPat = ['/pages/index/index', '/pages/order_addcart/order_addcart',
|
||||
'/pages/goods_cate/goods_cate',
|
||||
'/pages/user/index'
|
||||
]
|
||||
if (indexPat.includes(this.getPath(backUrl))) {
|
||||
@ -879,8 +917,12 @@
|
||||
wx.login({
|
||||
success(res) {
|
||||
if (res.code) {
|
||||
bindMp({ code: res.code, iv: iv, encryptedData: encryptedData, phone: that
|
||||
.account }).then(res => {
|
||||
bindMp({
|
||||
code: res.code,
|
||||
iv: iv,
|
||||
encryptedData: encryptedData,
|
||||
phone: that.account
|
||||
}).then(res => {
|
||||
// console.log(res);
|
||||
})
|
||||
} else {
|
||||
@ -894,6 +936,15 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
jpushModule.initJPushService()
|
||||
jpushModule.getRegistrationID(result => {
|
||||
if (result.registerID) {
|
||||
bindJG({
|
||||
phone: this.account,
|
||||
jg_register_id: result.registerID
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -902,9 +953,11 @@
|
||||
page {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
/deep/uni-checkbox .uni-checkbox-input {
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.ChangePassword .phone {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
@ -937,9 +990,12 @@
|
||||
width: 240rpx;
|
||||
|
||||
}
|
||||
/deep/.uni-input-wrapper,/deep/.uni-input-input{
|
||||
|
||||
/deep/.uni-input-wrapper,
|
||||
/deep/.uni-input-input {
|
||||
// width: 240rpx;
|
||||
}
|
||||
|
||||
.ChangePassword .list .item .code {
|
||||
font-size: 32rpx;
|
||||
background-color: #fff;
|
||||
@ -979,11 +1035,13 @@
|
||||
margin: 40rpx auto 0 auto;
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
|
||||
.iconfont {
|
||||
font-size: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.code image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@ -994,6 +1052,7 @@
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.settlementAgreement {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@ -1003,10 +1062,12 @@
|
||||
background: rgba(0, 0, 0, .5);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.protocol_text {
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.settlementAgreement .setAgCount {
|
||||
background: #fff;
|
||||
width: 656rpx;
|
||||
@ -1021,6 +1082,7 @@
|
||||
-moz-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
overflow: hidden;
|
||||
|
||||
.content {
|
||||
height: 900rpx;
|
||||
overflow-y: scroll;
|
||||
@ -1035,6 +1097,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.settlementAgreement .setAgCount .icon {
|
||||
font-size: 42rpx;
|
||||
color: #b4b1b4;
|
||||
@ -1043,12 +1106,14 @@
|
||||
right: 15rpx;
|
||||
|
||||
}
|
||||
|
||||
.settlementAgreement .setAgCount .title {
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.settlementAgreement .setAgCount .content {
|
||||
margin-top: 32rpx;
|
||||
color: #333;
|
||||
@ -1059,17 +1124,20 @@
|
||||
height: 756rpx;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.protocol {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.protocol_text {
|
||||
.font_pro {
|
||||
color: var(--view-theme);
|
||||
}
|
||||
}
|
||||
|
||||
.appLogin {
|
||||
.hds {
|
||||
display: flex;
|
||||
@ -1077,15 +1145,18 @@
|
||||
align-items: center;
|
||||
font-size: 24rpx;
|
||||
color: #B4B4B4;
|
||||
|
||||
.line {
|
||||
width: 68rpx;
|
||||
height: 1rpx;
|
||||
background: #CCCCCC;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -1131,6 +1202,7 @@
|
||||
.wx {
|
||||
// margin-right: 30rpx;
|
||||
background-color: #61C64F;
|
||||
|
||||
&.btn-apple {
|
||||
margin-right: 0;
|
||||
background-color: #333;
|
||||
@ -1233,6 +1305,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.copyright {
|
||||
position: fixed;
|
||||
bottom: 30rpx;
|
||||
|
Loading…
x
Reference in New Issue
Block a user