Commit ecc9b6b8 authored by fwz's avatar fwz

增加微信消息设置

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