Commit ecc9b6b8 authored by fwz's avatar fwz

增加微信消息设置

parent 8ad76083
......@@ -429,7 +429,21 @@ export default {
var that = this;
var setTime = 0;
if (!that.isSend) {
let phoneNumber;
this.formDate2.forEach(e=>{
if(e.rules.name=='phone'){
phoneNumber = e.rules.value
}
})
if(phoneNumber){
let opts = { url: '/app/smsCode/binding/' + phoneNumber, method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
that.isSend = true;
}
})
}
setTime = setInterval(function () {
that.wait--;
that.sendColor = "color:#999";
......@@ -444,12 +458,7 @@ export default {
}, 1000);
}else{
///app/smsCode/binding/{{phone}}
let opts = { url: '/app/smsCode/binding/' + this.phone, method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.model1.carInfo = res.data.data
}
})
}
},
},
......
......@@ -73,7 +73,7 @@ export default {
// this.$vervify(this.formData); //表单校验 成功会继续往下走 失败抛出异常
// const res = this.$submitForm(this.formData); //校验成功 获取表单值
console.log('表单对象 :>> ', this.formData);
// console.log('表单对象 :>> ', this.formData);
// uni.showToast({
// title: "验证码过期",
// icon: 'error',
......
......@@ -120,7 +120,7 @@ export default {
if (e.detail.errMsg == "getPhoneNumber:ok") {
that.decodePhoneLogin(e.detail)
} else {
console.log("用户点击了拒绝")
//console.log("用户点击了拒绝")
}
},
//解密手机号码
......
......@@ -166,8 +166,8 @@ export default {
uni.getLocation({
type: 'wgs84',
success: function (res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
//console.log('当前位置的经度:' + res.longitude);
//console.log('当前位置的纬度:' + res.latitude);
}
});
},
......@@ -214,7 +214,7 @@ export default {
})
},
fail: function (err) {
console.log('支付失败',err);
//console.log('支付失败',err);
},
});
} else {
......@@ -300,7 +300,7 @@ export default {
this.mallSelectMap[vo.id] += 1
}
this.countMoney += vo.currentPrice
console.log(this.mallSelectMap)
//console.log(this.mallSelectMap)
},
minusMall(vo){
......
......@@ -108,7 +108,7 @@ export default {
},
watch: {
carNumber(num) {
console.log(num);
//console.log(num);
},
},
methods: {
......
......@@ -72,7 +72,7 @@ export default {
}, this.$u.random(100, 1000));
},
goDetail(id){
console.log(id)
//console.log(id)
uni.navigateTo({
url: '/pagesB/pages/move-car/recordDetail?id='+id
})
......
......@@ -190,17 +190,17 @@ export default {
content: '无法获取当前位置,请手动开启授权',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
//console.log('用户点击确定')
uni.openSetting({
success(res) {
if (res.authSetting['scope.userLocation']) {
console.log('打开授权设置定位')
//console.log('打开授权设置定位')
_this.getLocation()
}
},
})
} else if (res.cancel) {
console.log('用户点击取消')
//console.log('用户点击取消')
}
},
})
......@@ -218,7 +218,7 @@ export default {
_this.loadCity(res.longitude, res.latitude)
},
fail() {
console.log('拒绝获取地理位置')
//console.log('拒绝获取地理位置')
}
})
},
......@@ -239,7 +239,7 @@ export default {
latitude +
'&key=1bba2ab2de600f8b5fafe167e09cd2af&radius=1000&extensions=all',
success(res) {
console.log(res);
//console.log(res);
if (res.statusCode === 200) {
if(res.data.status === '1') {
let addressInfo = res.data
......@@ -256,10 +256,10 @@ export default {
//区
that.appBo.countyName = addressInfo.regeocode.addressComponent.district
console.log("当前位置: " + that.appBo.detailInfo + " " + that.appBo.provinceName + " " + " " + that.appBo.cityName + " " + that.appBo.countyName)
//console.log("当前位置: " + that.appBo.detailInfo + " " + that.appBo.provinceName + " " + " " + that.appBo.cityName + " " + that.appBo.countyName)
}
} else {
console.log('获取信息失败,请重试!')
//console.log('获取信息失败,请重试!')
}
},
})
......@@ -278,7 +278,7 @@ export default {
// scene: e.scene
// }
this.moveCode = scene
console.log('scene: ' + scene);
//console.log('scene: ' + scene);
}
},
onShow() {
......
......@@ -129,7 +129,7 @@ export default {
}
}
console.log(this.moveCodeInfo)
//console.log(this.moveCodeInfo)
let opts = { url: '/app/moveCode/binding/', method: 'put' };
this.http.httpTokenRequest(opts, this.moveCodeInfo).then(res => {
if (res.data.code == 200) {
......@@ -163,7 +163,7 @@ export default {
this.moveCode = option.moveCode
},
onShow:function(){
console.log( this.$store.state.selectedCar);
//console.log( this.$store.state.selectedCar);
}
}
</script>
......
......@@ -120,7 +120,7 @@ export default {
}
let opts = { url: '/app/pay/order/submit/more', method: 'post' }
this.http.httpTokenRequest(opts, that.orderSubmit).then(res => {
console.log(res);
//console.log(res);
if (res.data.code == 200) {
let paymentData = res.data.data.invokeResponse;
......@@ -132,13 +132,13 @@ export default {
signType: paymentData.signType,
paySign: paymentData.paySign,
success: function (res) {
console.log('支付成功',res);
//console.log('支付成功',res);
uni.navigateTo({
url: '/pagesC/pages/shop/payOk'
})
},
fail: function (err) {
console.log('支付失败',err);
//console.log('支付失败',err);
},
});
} else {
......
......@@ -121,17 +121,17 @@ export default {
content: '无法获取当前位置,请手动开启授权',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
//console.log('用户点击确定')
uni.openSetting({
success(res) {
if (res.authSetting['scope.userLocation']) {
console.log('打开授权设置定位')
//console.log('打开授权设置定位')
_this.getLocation()
}
},
})
} else if (res.cancel) {
console.log('用户点击取消')
//console.log('用户点击取消')
}
},
})
......@@ -149,7 +149,7 @@ export default {
_this.loadCity(res.longitude, res.latitude)
},
fail() {
console.log('拒绝获取地理位置')
//console.log('拒绝获取地理位置')
}
})
},
......@@ -170,7 +170,7 @@ export default {
latitude +
'&key=1bba2ab2de600f8b5fafe167e09cd2af&radius=1000&extensions=all',
success(res) {
console.log(res);
//console.log(res);
if (res.statusCode === 200) {
if (res.data.status === '1') {
let addressInfo = res.data
......@@ -179,7 +179,7 @@ export default {
that.model1.addressInfo.address = detailInfo
}
} else {
console.log('获取信息失败,请重试!')
//console.log('获取信息失败,请重试!')
}
},
})
......
......@@ -30,7 +30,7 @@
<u--input v-model="model1.addressInfo.detailInfo" placeholder="例如 2栋3单元101室" border="none"></u--input>
</u-form-item>
<u-form-item label="设置默认地址:" prop="addressInfo.defaultFlag" ref="item1">
<u-switch class="del__address" v-model="model1.addressInfo.defaultFlag" activeColor="#5ac725" @change="change"></u-switch>
<u-switch class="del__address" v-model="model1.addressInfo.defaultFlag" activeColor="#5ac725"></u-switch>
</u-form-item>
</u--form>
......@@ -110,7 +110,7 @@ export default {
}
})
} else if (res.cancel) {
console.log('用户点击取消');
//console.log('用户点击取消');
}
}
});
......@@ -152,17 +152,17 @@ export default {
content: '无法获取当前位置,请手动开启授权',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
//console.log('用户点击确定')
uni.openSetting({
success(res) {
if (res.authSetting['scope.userLocation']) {
console.log('打开授权设置定位')
//console.log('打开授权设置定位')
_this.getLocation()
}
},
})
} else if (res.cancel) {
console.log('用户点击取消')
//console.log('用户点击取消')
}
},
})
......@@ -180,7 +180,7 @@ export default {
_this.loadCity(res.longitude, res.latitude)
},
fail() {
console.log('拒绝获取地理位置')
//console.log('拒绝获取地理位置')
}
})
},
......@@ -201,7 +201,7 @@ export default {
latitude +
'&key=1bba2ab2de600f8b5fafe167e09cd2af&radius=1000&extensions=all',
success(res) {
console.log(res);
//console.log(res);
if (res.statusCode === 200) {
if (res.data.status === '1') {
let addressInfo = res.data
......@@ -210,7 +210,7 @@ export default {
that.model1.addressInfo.address = detailInfo
}
} else {
console.log('获取信息失败,请重试!')
//console.log('获取信息失败,请重试!')
}
},
})
......
......@@ -5,9 +5,9 @@
<template>
<view class="appCotent">
<div class="hlep">
<u-cell-group>
<!-- <u-cell-group>
<u-cell title="设置消息订阅" :isLink="true" @click="openMsg()"></u-cell>
</u-cell-group>
</u-cell-group> -->
<image v-if="image" :src="image" />
<image v-else src="@/static/my/help.png"/>
</div>
......
......@@ -88,7 +88,12 @@ export default {
icon: require("@/static/my/my11.png"),
title: "问题反馈",
url: "/pagesD/pages/personal/ask"
}
},
{
icon: require("@/static/my/my15.png"),
title: "微信通知设置",
url: ""
},
],
items: [{
title: '待发货',
......@@ -136,9 +141,14 @@ export default {
});
},
goUrl(vo) {
if(vo.title != '微信通知设置'){
uni.navigateTo({
url: vo.url
});
}else {
this.openMsg()
}
},
editInfo() {
uni.navigateTo({
......@@ -154,6 +164,91 @@ export default {
}
})
},
openMsg() {
var that = this;
let nc_templateid = that.nc_templateid;
// 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
wx.getSetting({
withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回
success(res) {
if (that.is_authorization) {
wx.openSetting({
withSubscriptions: true,
});
} else {
if (res.subscriptionsSetting[nc_templateid] == "reject") {
//用户点击了“总是保持以上,不再询问”
wx.showModal({
title: "温馨提示",
content: "检测到您没有开启订阅消息的权限,是否去设置?",
success: function (modal) {
if (modal.confirm) {
// 点击肯定
wx.openSetting({
withSubscriptions: true,
});
that.is_authorization = true;
uni.setStorageSync("is_authorization", true);
} else {
uni.showToast({
title: "您已拒绝订阅消息授权,无法接收通知",
icon: "error",
});
that.is_authorization = false;
}
},
});
} else {
// 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
// var templateid = that.setting.templateid.map(item => item.tempid);
let tmpid = [nc_templateid];
uni.requestSubscribeMessage({
tmplIds: tmpid,
success(res) {
if (res[tmpid[0]] == "accept") {
uni.showToast({
title: "订阅成功",
icon: "none",
});
that.is_authorization = true;
uni.setStorageSync("is_authorization", true);
} else {
uni.showToast({
title: "您拒绝订阅消息授权,无法接收通知",
icon: "none",
});
that.is_authorization = false;
}
},
fail: (res) => {
wx.showModal({
title: "温馨提示",
content: "检测到您没有开启订阅消息的权限,是否去设置?",
success: function (modal) {
if (modal.confirm) {
// 点击肯定
wx.openSetting({
withSubscriptions: true,
});
that.is_authorization = true;
uni.setStorageSync("is_authorization", true);
} else {
uni.showToast({
title: "您已拒绝订阅消息授权,无法接收通知",
icon: "error",
});
that.is_authorization = false;
}
},
});
},
});
}
}
},
});
},
},
onShow() {
this.getUserInfo()
......
......@@ -190,7 +190,7 @@ export default {
methods: {
// 加载数据
load(paging) {
console.log(paging)
//console.log(paging)
setTimeout(() => {
let list = [];
let order = {}
......
......@@ -127,7 +127,7 @@ export default {
transformTime(timestamp) {
if (timestamp) {
var time = new Date(timestamp);
console.log(time);
//console.log(time);
var y = time.getFullYear(); //getFullYear方法以四位数字返回年份
var M = time.getMonth() + 1; // getMonth方法从 Date 对象返回月份 (0 ~ 11),返回结果需要手动加一
var d = time.getDate(); // getDate方法从 Date 对象返回一个月中的某一天 (1 ~ 31)
......@@ -184,7 +184,7 @@ export default {
this.show = false
},
clickFn(e) {
console.log(e)
//console.log(e)
switch (e) {
case 1:
this.show = true
......@@ -263,7 +263,7 @@ export default {
let uploadData = JSON.parse(res.data)
let opts = { url: '/app/user/update', method: 'post' };
let userInfoItem = { type: 1, val: uploadData.data.fileName };
console.log(userInfoItem)
//console.log(userInfoItem)
that.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) {
that.userInfo.avatar = res.data.url
......
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