提交 301ad8d8 编写于 作者: 芊里

问题反馈页面调整,表单必填,对齐

上级 013575cc
......@@ -19,12 +19,12 @@
}
}, {
"path": "uni_modules/uni-login-page/pages/index/index",
"style": {
"style": {
"navigationBarTitleText": "",
"app-plus": {
"animationType": "none",
"popGesture": "none",
"navigationStyle": "custom",
"popGesture": "none",
"navigationStyle": "custom",
"backgroundColor": "transparent"
// "titleNView": {
// "buttons": [{
......@@ -67,17 +67,17 @@
"navigationStyle": "custom"
}
}, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/list",
"path": "uni_modules/uni-feedback/pages/opendb-feedback/list",
"style": {
"navigationBarTitleText": "常见问题"
}
}, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/add",
"path": "uni_modules/uni-feedback/pages/opendb-feedback/add",
"style": {
"navigationBarTitleText": "问题反馈"
}
}, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/detail",
"path": "uni_modules/uni-feedback/pages/opendb-feedback/detail",
"style": {
"navigationBarTitleText": "问题反馈"
}
......@@ -161,24 +161,24 @@
}
}
,{
"path" : "pages/test/test",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/common/webview/webview",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/test/test",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/common/webview/webview",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
......@@ -187,16 +187,16 @@
"backgroundColor": "#F8F8F8"
},
"condition": {
"list": [
"list": [
{
"path": "uni_modules/uni-login-page/pages/index/index"
},
{
"path": "pages/test/test"
},
{
"path":"pages/ucenter/settings/settings"
}
},
{
"path": "pages/test/test"
},
{
"path":"pages/ucenter/settings/settings"
}
],
"current":2
},
......@@ -222,4 +222,4 @@
"text": "我的"
}]
}
}
}
......@@ -72,10 +72,14 @@
event: 'checkVersion',
showBadge: true
},
{
title:'去评分',
event:'gotoMarket'
},
//#endif
{
title: '问题与反馈',
to: '/uni_modules/opendb-feedback/pages/opendb-feedback/list' // /pages/ucenter/uni-feedback/uni-feedback uni_modules/opendb-feedback/pages/opendb-feedback/list
to: '/uni_modules/uni-feedback/pages/opendb-feedback/list' // /pages/ucenter/uni-feedback/uni-feedback uni_modules/uni-feedback/pages/opendb-feedback/list
},{
title: '关于',
to: '/pages/ucenter/about/about'
......@@ -96,11 +100,11 @@
methods: {
...mapMutations({
logout: 'user/logout'
}),
toSettings(){
uni.navigateTo({
url:"/pages/ucenter/settings/settings"
})
}),
toSettings(){
uni.navigateTo({
url:"/pages/ucenter/settings/settings"
})
},
/**
* 个人中心项目列表点击事件
......@@ -131,6 +135,26 @@
title: '你点击了,第' + (index+1) + '',
icon: 'none'
});
},
/**
* 去应用市场评分
*/
gotoMarket(){
// #ifdef APP-PLUS
if (uni.getSystemInfoSync().platform == "ios") {
// 这里填写appstore应用id
let appstoreid = 'id1417078253';
plus.runtime.openURL("itms-apps://" + 'itunes.apple.com/cn/app/wechat/'+appstoreid+'?mt=8');
}
if (uni.getSystemInfoSync().platform == "android") {
var Uri = plus.android.importClass("android.net.Uri");
var uri = Uri.parse("market://details?id=" + plus.runtime.appid );
var Intent = plus.android.importClass('android.content.Intent');
var intent = new Intent(Intent.ACTION_VIEW, uri);
var main = plus.android.runtimeMainActivity();
main.startActivity(intent);
}
// #endif
}
}
}
......@@ -275,4 +299,4 @@
/* #endif */
background-color: #DD524D;
}
</style>
</style>
......@@ -221,7 +221,8 @@
}
.feedback-uploader {
padding: 22rpx 20rpx;
padding: 22rpx 20rpx;
padding-left: 0;
}
.feedback-star {
......@@ -251,5 +252,11 @@
color: #FFFFFF;
margin: 20rpx;
}
.uni-uploader-title{
text-align: right;
flex: 1;
color: #B2B2B2;
padding-right: 10rpx;
}
</style>
<template>
<view class="uni-container">
<uni-forms ref="form" :value="formData" :rules="rules" validate-trigger="submit" err-show-type="toast">
<!-- <uni-forms-item name="user_id" label="">
<uni-easyinput placeholder="留言反馈用户ID/回复留言用户ID,参考uni-id-users表" v-model="formData.user_id" />
</uni-forms-item> -->
<!-- <uni-forms-item name="create_date" label="">
<uni-datetime-picker return-type="timestamp" :value="formData.create_date" />
</uni-forms-item> -->
<uni-forms-item name="content" label="反馈内容">
<uni-forms-item name="content" label="反馈内容" required>
<uni-easyinput placeholder="请输入反馈内容" type="textarea" v-model="formData.content" trim="right" />
</uni-forms-item>
<uni-forms-item name="imgs" label="反馈截图">
<!-- <uni-data-checkbox :multiple="true" v-model="formData.imgs" /> -->
<feedback-imgs :isChoose="true" :imgs="formData.imgs" @close="close" @chooseImg="chooseImg"></feedback-imgs>
</uni-forms-item>
<!-- <uni-forms-item name="is_reply" label="">
<switch @change="binddata('is_reply', $event.detail.value)" :checked="formData.is_reply" />
</uni-forms-item> -->
<!-- <uni-forms-item name="feedback_id" label="">
<uni-easyinput placeholder="被回复留言ID" v-model="formData.feedback_id" />
</uni-forms-item> -->
<uni-forms-item name="contact" label="联系人">
<uni-forms-item name="contact" label="联系人" required>
<uni-easyinput placeholder="请输入联系人" v-model="formData.contact" trim="both" />
</uni-forms-item>
<uni-forms-item name="mobile" label="联系方式">
<uni-forms-item name="mobile" label="联系方式" required>
<uni-easyinput placeholder="请输入手机号/邮箱" v-model="formData.mobile" trim="both" />
</uni-forms-item>
<!-- <uni-forms-item name="reply_count" label="">
<uni-easyinput placeholder="被回复条数" type="number" v-model="formData.reply_count" />
</uni-forms-item> -->
<view class="uni-button-group">
<button type="primary" class="uni-button" @click="submit">提交</button>
......@@ -122,13 +106,14 @@
},
submitForm(value) {
// 使用 clientDB 提交数据
db.collection(dbCollectionName).add(value).then((res) => {
uni.showToast({
icon: 'none',
title: '反馈成功'
})
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
db.collection(dbCollectionName).add(value).then((res) => {
uni.showModal({
title: '您的反馈已经提交成功,请耐心等待。',
showCancel: false,
success: res => {
uni.navigateBack()
},
});
}).catch((err) => {
uni.showModal({
content: err.message || '反馈失败',
......
<template>
<view class="uni-container">
<uni-forms ref="form" :value="formData" validate-trigger="submit" err-show-type="toast">
<uni-forms-item name="avatar" label="头像地址">
<uni-easyinput placeholder="头像地址" v-model="formData.avatar" trim="both" />
</uni-forms-item>
<uni-forms-item name="gender" label="性别">
<uni-data-checkbox v-model="formData.gender" :localdata="formOptions.gender_localdata" />
</uni-forms-item>
<uni-forms-item name="mobile" label="手机号码">
<uni-easyinput placeholder="手机号码" v-model="formData.mobile" trim="both" />
</uni-forms-item>
<uni-forms-item name="nickname" label="昵称">
<uni-easyinput placeholder="用户昵称" v-model="formData.nickname" trim="both" />
</uni-forms-item>
<view class="uni-button-group">
<button type="primary" class="uni-button" @click="submit">提交</button>
</view>
</uni-forms>
</view>
</template>
<script>
import { validator } from '../../js_sdk/validator/uni-id-users.js';
const db = uniCloud.database();
const dbCollectionName = 'uni-id-users';
function getValidator(fields) {
let reuslt = {}
for (let key in validator) {
if (fields.indexOf(key) > -1) {
reuslt[key] = validator[key]
}
}
return reuslt
}
export default {
data() {
return {
formData: {
"avatar": "",
"gender": 0,
"mobile": "",
"nickname": ""
},
formOptions: {
"gender_localdata": [
{
"text": "未知",
"value": 0
},
{
"text": "",
"value": 1
},
{
"text": "",
"value": 2
}
]
},
rules: {
...getValidator(["avatar","gender","mobile","nickname"])
}
}
},
onReady() {
this.$refs.form.setRules(this.rules)
},
methods: {
/**
* 触发表单提交
*/
submit() {
uni.showLoading({
mask: true
})
this.$refs.form.submit().then((res) => {
this.submitForm(res)
}).catch((errors) => {
uni.hideLoading()
})
},
submitForm(value) {
// 使用 clientDB 提交数据
db.collection(dbCollectionName).add(value).then((res) => {
uni.showToast({
icon: 'none',
title: '新增成功'
})
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
}).finally(() => {
uni.hideLoading()
})
}
}
}
</script>
<style>
.uni-container {
padding: 15px;
}
.uni-input-border,
.uni-textarea-border {
width: 100%;
font-size: 14px;
color: #666;
border: 1px #e5e5e5 solid;
border-radius: 5px;
box-sizing: border-box;
}
.uni-input-border {
padding: 0 10px;
height: 35px;
}
.uni-textarea-border {
padding: 10px;
height: 80px;
}
.uni-button-group {
margin-top: 50px;
display: flex;
justify-content: center;
}
.uni-button {
width: 184px;
padding: 12px 20px;
font-size: 14px;
border-radius: 4px;
line-height: 1;
margin: 0;
}
</style>
<template>
<view class="container">
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" :options="options" collection="uni-id-users,opendb-department,uni-id-roles" field="avatar,gender,mobile,nickname" :where="queryWhere" :getone="true" :manual="true">
<view v-if="error">{{error.message}}</view>
<view v-else-if="loading">
<uni-load-more :contentText="loadMore" status="loading"></uni-load-more>
</view>
<view v-else-if="data">
<view>
<text>头像地址:</text>
<text>{{data.avatar}}</text>
</view>
<view>
<text>性别:</text>
<text>{{options.gender_valuetotext[data.gender]}}</text>
</view>
<view>
<text>手机号码:</text>
<text>{{data.mobile}}</text>
</view>
<view>
<text>昵称:</text>
<text>{{data.nickname}}</text>
</view>
</view>
</unicloud-db>
<view class="btns">
<button type="primary" @click="handleUpdate">修改</button>
<button type="warn" class="btn-delete" @click="handleDelete">删除</button>
</view>
</view>
</template>
<script>
// 由schema2code生成,包含校验规则和enum静态数据
import { enumConverter } from '../../js_sdk/validator/uni-id-users.js';
export default {
data() {
return {
queryWhere: '',
loadMore: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
},
options: {
// 将scheme enum 属性静态数据中的value转成text
...enumConverter
}
}
},
onLoad(e) {
this._id = e.id
},
onReady() {
if (this._id) {
this.queryWhere = '_id=="' + this._id + '"'
}
},
methods: {
handleUpdate() {
// 打开修改页面
uni.navigateTo({
url: '../uni-id-users/edit?id=' + this._id,
events: {
// 监听修改页面成功修改数据后, 刷新当前页面数据
refreshData: () => {
this.$refs.udb.loadData({
clear: true
})
}
}
})
},
handleDelete() {
this.$refs.udb.remove(this._id, {
success: (res) => {
// 删除数据成功后跳转到list页面
uni.navigateTo({
url: '../uni-id-users/list'
})
}
})
}
}
}
</script>
<style>
.container {
padding: 10px;
}
.btns {
margin-top: 10px;
display: flex;
flex-direction: row;
}
.btns button {
flex: 1;
}
.btn-delete {
margin-left: 10px;
}
</style>
<template>
<view class="container">
<unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" collection="uni-id-users" field="">
<view v-if="error">{{error.message}}</view>
<view v-else-if="data">
<uni-list>
<uni-list-item v-for="(item, index) in data" :key="index" showArrow :clickable="true" @click="handleItemClick(item._id)">
<view slot="body">
<!-- 此处默认显示为_id,请根据需要自行修改为其他字段 -->
{{item._id}}
</view>
</uni-list-item>
</uni-list>
</view>
<uni-load-more :status="loading?'loading':(hasMore ? 'more' : 'noMore')"></uni-load-more>
</unicloud-db>
<uni-fab ref="fab" horizontal="right" vertical="bottom" :pop-menu="false" @fabClick="fabClick" />
</view>
</template>
<script>
export default {
data() {
return {
loadMore: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
}
}
},
onPullDownRefresh() {
this.$refs.udb.loadData({
clear: true
}, () => {
uni.stopPullDownRefresh()
})
},
onReachBottom() {
this.$refs.udb.loadMore()
},
methods: {
handleItemClick(id) {
uni.navigateTo({
url: './detail?id=' + id
})
},
fabClick() {
// 打开新增页面
uni.navigateTo({
url: './add',
events: {
// 监听新增数据成功后, 刷新当前页面数据
refreshData: () => {
this.$refs.udb.loadData({
clear: true
})
}
}
})
}
}
}
</script>
<style>
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册