You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
3.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="box">
<view class="bgtop">
<image src="../../static/img/nav_top.png" style="width: 100%;height: 100%;"></image>
</view>
<view class="bgcenter" :style="{height:height+'px'}">
<view class="box-content">
<u--form labelPosition="top" :model="form">
<u-form-item label="手机号" prop="mobile" labelWidth="60px" required>
<u-input v-model="form.mobile" placeholder="请输入手机号"></u-input>
</u-form-item>
<u-form-item label="内容" prop="content" labelWidth="60px" required>
<u--textarea v-model="form.content" placeholder="请输入内容"></u--textarea>
</u-form-item>
</u--form>
<u-button type="primary" @click="tosubmit">确认提交</u-button>
</view>
</view>
<view class="bgbottom">
<image src="../../static/img/nav_bottom.png" style="width: 100%;height: 100%;"></image>
</view>
</view>
</template>
<script>
export default {
data() {
return {
height: 0,
form: {
mobile: "",
content: ""
}
}
},
onLoad() {
let that = this;
uni.getSystemInfo({
success: function(res) {
that.height = res.windowHeight - 60;
}
});
},
methods: {
tosubmit() {
let that = this;
if (this.util.isNull(that.form.mobile)) {
this.util.toast("请填写手机号!");
return false;
} else {
if (!uni.$u.test.mobile(that.form.mobile)) {
this.util.toast("请填写正确的手机号!");
return false;
}
}
if (this.util.isNull(that.form.content)) {
this.util.toast("请填写内容!");
return false;
}
this.util.request({
api: '/api/mobile/other/tip-store',
data: this.form,
method: "POST",
utilSuccess: function(res) {
console.log(res)
that.newsSubscription();
},
utilFail: function(res) {
that.util.toast(res);
}
})
},
newsSubscription() {
uni.getSetting({
withSubscriptions: true, //是否获取用户订阅消息的订阅状态默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.redirectTo({
url: '/pages/success/success?from=feed'
})
} else {
// 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ['gPP22-SXuJmK9ffJZTNOSdq56Q2RmD2Qdg8ntteAO-Y'],
success(res) {
uni.showToast({
title: '订阅成功'
})
uni.redirectTo({
url: '/pages/success/success?from=feed'
})
}
})
}
}
});
},
}
}
</script>
<style>
.box {
padding: 20rpx;
box-sizing: border-box;
}
.u-input {
background-color: #fff;
}
.bgtop {
height: 40rpx;
}
.bgcenter {
background: url("../../static/img/nav_middle.png") repeat-y;
background-size: 100% 100%;
}
.box-content {
padding: 15rpx 40rpx;
color: #351C1B;
box-sizing: border-box;
}
.title {}
.time {
font-size: 24rpx;
}
.bgbottom {
height: 40rpx;
}
</style>