111
This commit is contained in:
parent
3826ce26ca
commit
03a1b6994b
|
@ -88,7 +88,7 @@
|
|||
onLoad() {
|
||||
let that = this
|
||||
xBlufi.initXBlufi(1);
|
||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
|
||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': true
|
||||
})
|
||||
|
@ -113,7 +113,7 @@
|
|||
this.flag = false
|
||||
let that = this
|
||||
xBlufi.initXBlufi(1);
|
||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
|
||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': true
|
||||
})
|
||||
|
@ -190,14 +190,14 @@
|
|||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||
this.ver_data = this.parseCustomData(options.data)
|
||||
console.log("1收到设备发来的自定义数据结果:", this.ver_data);
|
||||
console.log("1收到设备发来的自定义数据结果:", this.ver_data)
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
||||
if (options.result) {
|
||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||
let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 5) === "WATER");
|
||||
let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
||||
let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 5) === "WATER")
|
||||
// 将过滤后的数组重新赋值给 this.devicesList
|
||||
this.devicesList = filteredDevices;
|
||||
this.devicesList = filteredDevices
|
||||
}
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||
|
@ -233,7 +233,7 @@
|
|||
power,
|
||||
remainingPower,
|
||||
setMode
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,14 +40,12 @@
|
|||
上传图片
|
||||
</view>
|
||||
<view class="icon">
|
||||
|
||||
<view class="imgbox" v-for="(item,index) in imglist " :key="index">
|
||||
<image :src="item" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="imgbox" @click="btn">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uY8CPw9YE6JxPzcHUaqf" mode=""></image>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<text>上传问题图片可以让问题快速解决哦!</text>
|
||||
</view>
|
||||
|
@ -58,15 +56,6 @@
|
|||
</view>
|
||||
<input type="text" v-model="contact" placeholder="请留下手机号/邮箱/微信号,以便我们回复您"/>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="lxfs" v-if="stause">
|
||||
<view class="title">
|
||||
联系方式
|
||||
</view>
|
||||
<input type="text" v-model="contact" placeholder="请留下手机号/邮箱/微信号,以便我们回复您" />
|
||||
</view>
|
||||
|
||||
<view class="btn" @click="sub()">提交</view>
|
||||
</view>
|
||||
|
@ -85,7 +74,6 @@
|
|||
imglist: [],
|
||||
token: '',
|
||||
contact: '',
|
||||
stause:false,
|
||||
picdomain:''
|
||||
}
|
||||
},
|
||||
|
@ -109,21 +97,19 @@
|
|||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
this.getQiniuToken()
|
||||
// this.getstause()
|
||||
this.getQiniuToken()
|
||||
},
|
||||
methods: {
|
||||
hidePlaceholder() {
|
||||
this.placeholderVisible = false;
|
||||
this.placeholderVisible = false
|
||||
},
|
||||
showPlaceholder() {
|
||||
if (!this.textValue) {
|
||||
this.placeholderVisible = true;
|
||||
this.placeholderVisible = true
|
||||
}
|
||||
},
|
||||
updateWordCount() {
|
||||
this.currentCount = this.textValue.trim().replace(/\s+/g, '').length;
|
||||
this.currentCount = this.textValue.trim().replace(/\s+/g, '').length
|
||||
},
|
||||
sub() {
|
||||
if (this.cutidx == -1) {
|
||||
|
@ -131,21 +117,21 @@
|
|||
title: '请选择反馈类型',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
} else if (this.textValue == '') {
|
||||
uni.showToast({
|
||||
title: '请输入问题描述',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
} else if (this.contact == '') {
|
||||
uni.showToast({
|
||||
title: '请输入联系方式',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
} else {
|
||||
var imgString = this.imglist.join(',');
|
||||
var imgString = this.imglist.join(',')
|
||||
let data = {
|
||||
type: this.cutidx,
|
||||
issueDescription: this.textValue,
|
||||
|
@ -163,7 +149,7 @@
|
|||
uni.navigateBack()
|
||||
},1500)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
btn() {
|
||||
|
@ -183,7 +169,7 @@
|
|||
key: 'smartmeter/img/' + math
|
||||
},
|
||||
success: function(res) {
|
||||
console.log(res, 'resres');
|
||||
console.log(res, 'resres')
|
||||
let str = JSON.parse(res.data)
|
||||
_this.userImgs = _this.picdomain + '/' + str.key
|
||||
console.log(_this.userImgs)
|
||||
|
|
|
@ -92,12 +92,12 @@
|
|||
// 点击拍照
|
||||
photo() {
|
||||
let that = this
|
||||
const cameraContext = uni.createCameraContext();
|
||||
const cameraContext = uni.createCameraContext()
|
||||
cameraContext.takePhoto({
|
||||
quality: 'high',
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
const tempFilePath = res.tempImagePath;
|
||||
console.log(res)
|
||||
const tempFilePath = res.tempImagePath
|
||||
that.maskpic = res.tempImagePath
|
||||
that.tempFilePathpic = res.tempImagePath
|
||||
uni.showLoading({
|
||||
|
@ -121,22 +121,22 @@
|
|||
userId:that.userid
|
||||
}
|
||||
that.$u.get(`/app/plant/identify`,data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
that.zwlist = res.data
|
||||
uni.hideLoading()
|
||||
// 跳转到植物列表
|
||||
uni.navigateTo({
|
||||
url: '/page_user/photolist?list=' + JSON.stringify(that.zwlist) + '&cart=' + JSON.stringify(that.tempFilePathpic)
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '网络波动异常,请重新识别',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (res.code == 200) {
|
||||
that.zwlist = res.data
|
||||
uni.hideLoading()
|
||||
// 跳转到植物列表
|
||||
uni.navigateTo({
|
||||
url: '/page_user/photolist?list=' + JSON.stringify(that.zwlist) + '&cart=' + JSON.stringify(that.tempFilePathpic)
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '网络波动异常,请重新识别',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
@ -180,21 +180,21 @@
|
|||
userId:that.userid
|
||||
}
|
||||
that.$u.get(`/app/plant/identify`,data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
that.zwlist = res.data
|
||||
uni.hideLoading()
|
||||
// 跳转到植物列表
|
||||
uni.navigateTo({
|
||||
url: '/page_user/photolist?list=' + JSON.stringify(that.zwlist) + '&cart=' + JSON.stringify(that.tempFilePathpic)
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '网络波动异常,请重新识别',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
})
|
||||
if (res.code == 200) {
|
||||
that.zwlist = res.data
|
||||
uni.hideLoading()
|
||||
// 跳转到植物列表
|
||||
uni.navigateTo({
|
||||
url: '/page_user/photolist?list=' + JSON.stringify(that.zwlist) + '&cart=' + JSON.stringify(that.tempFilePathpic)
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '网络波动异常,请重新识别',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -121,14 +121,14 @@
|
|||
},
|
||||
parseData(text) {
|
||||
// 根据换行符分割文本为数组
|
||||
const items = text.split('\n');
|
||||
const items = text.split('\n')
|
||||
// 遍历每个条目,并添加序号
|
||||
items.forEach((item, index) => {
|
||||
// 去除条目前后的空白字符
|
||||
const trimmedItem = item.trim();
|
||||
const trimmedItem = item.trim()
|
||||
// 如果条目不为空,则添加到格式化列表中,并添加序号
|
||||
if (trimmedItem) {
|
||||
this.formattedList.push(`${trimmedItem}`);
|
||||
this.formattedList.push(`${trimmedItem}`)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
<u-navbar :is-back="true" :title='tit' title-color="#000" :border-bottom="false" :background="bgc"
|
||||
id="navbar">
|
||||
</u-navbar>
|
||||
|
||||
<view class="" v-html="cont">
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
@ -15,7 +17,9 @@
|
|||
bgc: {
|
||||
backgroundColor: "#fff",
|
||||
},
|
||||
tit:''
|
||||
tit:'',
|
||||
id:'',
|
||||
cont:''
|
||||
}
|
||||
},
|
||||
// 分享到好友(会话)
|
||||
|
@ -36,9 +40,17 @@
|
|||
},
|
||||
onLoad(option) {
|
||||
this.tit = option.tit
|
||||
this.id = option.id
|
||||
this.getxq()
|
||||
},
|
||||
methods:{
|
||||
|
||||
getxq() {
|
||||
this.$u.get(`/app/article/${this.id}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.cont = res.data.content
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -76,18 +76,22 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button @click="kq">开启</button><button @click="gb">关闭</button>
|
||||
<!-- 开关选择 -->
|
||||
<view class="switchbox">
|
||||
<view class="switch_he">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/u7NwkNOoQYYsvHVMkDlu" mode=""></image>
|
||||
<view class="yushui">
|
||||
雨水感应 <u-switch v-model="yschecked" @change="btnyushui" active-color="#7FAD76" size="40"></u-switch>
|
||||
雨水感应
|
||||
<u-switch v-if="yschecked" v-model="one" @change="btnyushui" inactive-color="#eee" active-color="#eee" size="40"></u-switch>
|
||||
<u-switch v-else v-model="ones" @change="btnyushuis" active-color="#7FAD76" inactive-color="#7FAD76" size="40"></u-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="switch_he">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/u7kd92ocUgDN052nhp4R" mode=""></image>
|
||||
<view class="yushui">
|
||||
儿童锁 <u-switch v-model="etchecked" active-color="#7FAD76" size="40"></u-switch>
|
||||
儿童锁 <u-switch v-if="etchecked" v-model="two" @change="btnertong" inactive-color="#eee" active-color="#eee" size="40"></u-switch>
|
||||
<u-switch v-else v-model="twos" @change="btnertongs" active-color="#7FAD76" inactive-color="#7FAD76" size="40"></u-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -175,8 +179,12 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
yschecked: true,
|
||||
etchecked: true,
|
||||
one:false,
|
||||
ones:true,
|
||||
two:false,
|
||||
twos:true,
|
||||
yschecked: '',
|
||||
etchecked: '',
|
||||
kgflag: false,
|
||||
activeshu: 0,
|
||||
xuanzeflag: false,
|
||||
|
@ -221,8 +229,8 @@
|
|||
},
|
||||
onLoad() {
|
||||
let that = this
|
||||
xBlufi.initXBlufi(1);
|
||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
|
||||
xBlufi.initXBlufi(1)
|
||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': true
|
||||
})
|
||||
|
@ -246,57 +254,148 @@
|
|||
|
||||
},
|
||||
methods: {
|
||||
kq(){
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData:'11open'
|
||||
})
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
gb(){
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData:'11close'
|
||||
})
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 雨水感应
|
||||
btnyushui(){
|
||||
if(this.yschecked == true){
|
||||
let that = this
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData:'qlose'
|
||||
})
|
||||
that.yschecked = false
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
}
|
||||
let that = this
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
that.yschecked = false
|
||||
xBlufi.notifySendCustomData({
|
||||
customData:'11yudi'
|
||||
})
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
}
|
||||
})
|
||||
}else{
|
||||
console.log(11);
|
||||
let that = this
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData:'qpen'
|
||||
})
|
||||
that.yschecked = true
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
btnyushuis(){
|
||||
let that = this
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
that.yschecked = true
|
||||
xBlufi.notifySendCustomData({
|
||||
customData:'11unyudi'
|
||||
})
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 点击儿童锁
|
||||
btnertong(){
|
||||
let that = this
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
that.etchecked = false
|
||||
xBlufi.notifySendCustomData({
|
||||
customData:'11lock'
|
||||
})
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
btnertongs(){
|
||||
let that = this
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
that.etchecked = true
|
||||
xBlufi.notifySendCustomData({
|
||||
customData:'11unlock'
|
||||
})
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 点击添加设备
|
||||
btnaddsb(){
|
||||
|
@ -434,22 +533,40 @@
|
|||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||||
if (options.result) {
|
||||
let devicesarr = options.data
|
||||
console.log(devicesarr,'111');
|
||||
console.log(devicesarr,'111')
|
||||
devicesarr.forEach(device => {
|
||||
const mac = device.name.substring(4);
|
||||
const mac = device.name.substring(4)
|
||||
if (device.name.slice(5, 17) == this.mac) {
|
||||
this.deviceId = device.deviceId
|
||||
this.name = device.name
|
||||
// console.log(device.name,this.mac,'222');
|
||||
this.devicesList.push(device);
|
||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||
this.devicesList.push(device)
|
||||
let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
||||
this.devicesList = uniqueDevicesList;
|
||||
}
|
||||
})
|
||||
}
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
||||
console.log("连接回调:" + JSON.stringify(options));
|
||||
console.log("连接回调:" + JSON.stringify(options))
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(()=> {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11unlock"
|
||||
})
|
||||
},1500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('device_key', 'true')
|
||||
if (options.result) {
|
||||
{
|
||||
|
@ -464,15 +581,15 @@
|
|||
}
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||
console.log("1收到设备发来的自定义数据结果:", options.data);
|
||||
console.log("1收到设备发来的自定义数据结果:", options.data)
|
||||
this.ver_data = this.parseCustomData(options.data)
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
||||
if (options.result) {
|
||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||
let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
||||
let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 5) === "WATER")
|
||||
// 将过滤后的数组重新赋值给 this.devicesList
|
||||
this.devicesList = filteredDevices;
|
||||
this.devicesList = filteredDevices
|
||||
}
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||
|
@ -483,12 +600,10 @@
|
|||
duration: 3000
|
||||
})
|
||||
return
|
||||
} else {
|
||||
|
||||
}
|
||||
break
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
// 从蓝牙拿到数据进行解析
|
||||
parseCustomData(data) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<view class="wjmm" @click="btnwjmm">
|
||||
忘记密码
|
||||
</view>
|
||||
<view class="zcbdl">
|
||||
<view class="zcbdl" @click="btndl">
|
||||
登录
|
||||
</view>
|
||||
<view class="you">
|
||||
|
@ -79,6 +79,29 @@
|
|||
|
||||
},
|
||||
methods:{
|
||||
// 点击登录
|
||||
btndl(){
|
||||
let data = {
|
||||
phone:this.tel,
|
||||
// phoneCode:this.yzm,
|
||||
// uuid:this.uuid,
|
||||
password:this.password
|
||||
}
|
||||
this.$u.post(`/appCodeLogin`,data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
wx.setStorageSync('token', res.token)
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 点击微信一键登录
|
||||
getPhoneNumber(e) {
|
||||
this.jsCode = e.detail.code
|
||||
|
@ -107,7 +130,7 @@
|
|||
wxLoginAsync().then(async (data) => {
|
||||
this.$u.post(`/wxlogin?mobileCode=${this.jsCode}&jsCode=${this.mobileCode}`, data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
wx.setStorageSync('token', res.token);
|
||||
wx.setStorageSync('token', res.token)
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view class="quer" @click="btnqr">
|
||||
<view class="quer" @click="btnwj">
|
||||
确定
|
||||
</view>
|
||||
|
||||
|
@ -70,7 +70,8 @@
|
|||
tel:'',
|
||||
yzm:'',
|
||||
countdown: 60,
|
||||
timer: null
|
||||
timer: null,
|
||||
uuid:''
|
||||
}
|
||||
},
|
||||
// 分享到好友(会话)
|
||||
|
@ -94,9 +95,69 @@
|
|||
},
|
||||
onUnload() {
|
||||
// 页面卸载时清除定时器,防止内存泄漏
|
||||
clearInterval(this.timer);
|
||||
clearInterval(this.timer)
|
||||
},
|
||||
methods:{
|
||||
// 点击确定忘记密码
|
||||
btnwj(){
|
||||
if(this.tel == ''){
|
||||
uni.showToast({
|
||||
title: '手机号不能为空',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else if(this.yzm == ''){
|
||||
uni.showToast({
|
||||
title: '验证码不能为空',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else if(this.password == ''){
|
||||
uni.showToast({
|
||||
title: '新密码不能为空',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else if(this.passwords == ''){
|
||||
uni.showToast({
|
||||
title: '确认新密码不能为空',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else if(this.password != this.passwords){
|
||||
uni.showToast({
|
||||
title: '两次密码不一致',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else{
|
||||
let data = {
|
||||
phone:this.tel,
|
||||
phoneCode:this.yzm,
|
||||
uuid:this.uuid,
|
||||
password:this.password
|
||||
}
|
||||
this.$u.put(`/forgetAppPwd?phone=${this.tel}&phoneCode=${this.yzm}&newPassword=${this.password}&uuid=${this.uuid}`,data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '操作成功',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack()
|
||||
},1500)
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
btn(num){
|
||||
if(num == 1){
|
||||
this.txt = 'txt'
|
||||
|
@ -121,25 +182,24 @@
|
|||
if (this.countdown > 0) {
|
||||
this.countdown--
|
||||
} else {
|
||||
clearInterval(this.timer); // 倒计时结束,清除定时器
|
||||
clearInterval(this.timer) // 倒计时结束,清除定时器
|
||||
this.countdown = 60
|
||||
}
|
||||
}, 1000); // 每秒更新一次
|
||||
}, 1000) // 每秒更新一次
|
||||
},
|
||||
// 如果需要在其他地方停止倒计时,可以添加这个方法
|
||||
stopCountdown() {
|
||||
clearInterval(this.timer);
|
||||
this.countdown = 0; // 可选:将倒计时重置为0
|
||||
clearInterval(this.timer)
|
||||
this.countdown = 0 // 可选:将倒计时重置为0
|
||||
},
|
||||
|
||||
// 点击获取验证码
|
||||
btnhuoqu(){
|
||||
this.startCountdown()
|
||||
this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => {
|
||||
this.uuid = res.uuid
|
||||
})
|
||||
},
|
||||
// 点击确认忘记密码
|
||||
btnqr(){
|
||||
console.log(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</view>
|
||||
|
||||
<u-checkbox-group>
|
||||
<u-checkbox v-model="checked" shape="circle" active-color="#90B389"><text class="xieyi">我已阅读并同意 <text @click="btnyh(1)">用户协议</text> 和 <text @click="btnyh(2)">隐私政策</text></text></u-checkbox>
|
||||
<u-checkbox v-model="checked" shape="circle" active-color="#90B389"><text class="xieyi">我已阅读并同意 <text @click.stop="btnyh(1)">用户协议</text> 和 <text @click.stop="btnyh(2)">隐私政策</text></text></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
<view class="zcbdl" @click="btnzhuce">
|
||||
注册并登录
|
||||
|
@ -78,7 +78,8 @@
|
|||
tel:'',
|
||||
yzm:'',
|
||||
countdown: 60,
|
||||
timer: null
|
||||
timer: null,
|
||||
uuid:''
|
||||
}
|
||||
},
|
||||
// 分享到好友(会话)
|
||||
|
@ -102,7 +103,7 @@
|
|||
},
|
||||
onUnload() {
|
||||
// 页面卸载时清除定时器,防止内存泄漏
|
||||
clearInterval(this.timer);
|
||||
clearInterval(this.timer)
|
||||
},
|
||||
methods:{
|
||||
// 注册并登录
|
||||
|
@ -132,7 +133,26 @@
|
|||
duration: 2000
|
||||
})
|
||||
}else{
|
||||
|
||||
let data = {
|
||||
phone:this.tel,
|
||||
phoneCode:this.yzm,
|
||||
uuid:this.uuid,
|
||||
password:this.password
|
||||
}
|
||||
this.$u.post(`/appCodeLogin`,data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
wx.setStorageSync('token', res.token)
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -164,7 +184,7 @@
|
|||
wxLoginAsync().then(async (data) => {
|
||||
this.$u.post(`/wxlogin?mobileCode=${this.jsCode}&jsCode=${this.mobileCode}`, data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
wx.setStorageSync('token', res.token);
|
||||
wx.setStorageSync('token', res.token)
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
|
@ -192,21 +212,23 @@
|
|||
if (this.countdown > 0) {
|
||||
this.countdown--
|
||||
} else {
|
||||
clearInterval(this.timer); // 倒计时结束,清除定时器
|
||||
clearInterval(this.timer) // 倒计时结束,清除定时器
|
||||
this.countdown = 60
|
||||
}
|
||||
}, 1000); // 每秒更新一次
|
||||
},
|
||||
// 如果需要在其他地方停止倒计时,可以添加这个方法
|
||||
stopCountdown() {
|
||||
clearInterval(this.timer);
|
||||
this.countdown = 0; // 可选:将倒计时重置为0
|
||||
clearInterval(this.timer)
|
||||
this.countdown = 0 // 可选:将倒计时重置为0
|
||||
},
|
||||
|
||||
// 点击获取验证码
|
||||
btnhuoqu(){
|
||||
this.startCountdown()
|
||||
this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => {})
|
||||
this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => {
|
||||
this.uuid = res.uuid
|
||||
})
|
||||
},
|
||||
// 点击跳转到立即登录页
|
||||
btnljdl(){
|
||||
|
@ -218,11 +240,11 @@
|
|||
btnyh(num){
|
||||
if(num == 1){
|
||||
uni.navigateTo({
|
||||
url:'/page_user/yinsixq?tit=' + '用户协议'
|
||||
url:'/page_user/yinsixq?tit=' + '用户协议' + '&id=' + 1
|
||||
})
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url:'/page_user/yinsixq?tit=' + '隐私政策'
|
||||
url:'/page_user/yinsixq?tit=' + '隐私政策' + '&id=' + 2
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
13
pages/my.vue
13
pages/my.vue
|
@ -65,7 +65,6 @@
|
|||
imageSrc:'',
|
||||
token:'',
|
||||
picdomain:''
|
||||
|
||||
}
|
||||
},
|
||||
// 分享到好友(会话)
|
||||
|
@ -91,7 +90,7 @@
|
|||
methods: {
|
||||
// 获取用户信息
|
||||
getinfo() {
|
||||
this.$u.get(`//appVerify/profile`).then((res) => {
|
||||
this.$u.get(`/appVerify/profile`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.userobj = res.data
|
||||
this.imageSrc = res.data.avatar
|
||||
|
@ -148,15 +147,15 @@
|
|||
btnxq(num){
|
||||
if(num == 1){
|
||||
uni.navigateTo({
|
||||
url:'/page_user/yinsixq?tit=' + '隐私政策'
|
||||
url:'/page_user/yinsixq?tit=' + '隐私政策' + '&id=' + 2
|
||||
})
|
||||
}else if(num == 2){
|
||||
uni.navigateTo({
|
||||
url:'/page_user/yinsixq?tit=' + '用户协议'
|
||||
url:'/page_user/yinsixq?tit=' + '用户协议' + '&id=' + 1
|
||||
})
|
||||
}else if(num == 3){
|
||||
uni.navigateTo({
|
||||
url:'/page_user/yinsixq?tit=' + '关于我们'
|
||||
url:'/page_user/yinsixq?tit=' + '关于我们' + '&id=' + 3
|
||||
})
|
||||
}else if(num == 4){
|
||||
uni.showModal({
|
||||
|
@ -166,10 +165,10 @@
|
|||
if (res.confirm) {
|
||||
uni.clearStorage().then(() => {
|
||||
// 成功清空所有本地存储
|
||||
console.log('所有本地存储数据已清空');
|
||||
console.log('所有本地存储数据已清空')
|
||||
}).catch((error) => {
|
||||
// 处理错误
|
||||
console.error('清空本地存储失败', error);
|
||||
console.error('清空本地存储失败', error)
|
||||
})
|
||||
uni.reLaunch({
|
||||
url:'/pages/login/login'
|
||||
|
|
Loading…
Reference in New Issue
Block a user