提交 7826c557 编写于 作者: DCloud_JSON's avatar DCloud_JSON

调整意见反馈功能的文件名等

上级 40e5e40d
......@@ -5,11 +5,11 @@
### 介绍
`uni-starter`,是一个云端一体的、集成了商用项目开发常见功能的项目模板。
如果说uniCloud admin是管理端项目的基础模板,那么uni-starter则是用户端、尤其是移动端的基础模板。
在HBuilderX新建项目时选择uni-starter项目模板,在这个模板基础之上快速填充自己的业务,即可很快完成一个应用。
在HBuilderX新建项目时选择`uni-starter`项目模板,在这个模板基础之上快速填充自己的业务,即可很快完成一个应用。
地址:[https://codechina.csdn.net/dcloud/uni-starter.git](https://codechina.csdn.net/dcloud/uni-starter.git)
#### 项目背景
在过去我们会收集到开发者,咨询的各种问题,其中我们总结了高频。我们一直想出一个结合uni-app、uniCloud和openDB以及uni-id和uniCloud admin等,uni全家桶的项目模板;
我们一直想出一个结合uni-app、uniCloud和openDB以及uni-id和uniCloud admin等,uni全家桶的项目模板;
为了照顾各类应用的开发者,我们取交集最终罗列了如下功能,发现这些就是除业务逻辑外的项目基本功能并把它命名为`uni-starter`
uni-starter将节省开发者大量的时间,让开发者集中精力在自己的特色业务上。
有了uni-starter,再加上schema2code生成前端页面,一个简单应用就可以快速完成。
......@@ -92,24 +92,35 @@ img{
#### 2.登陆模块
- uni-start集成的登陆方式有:验证码登陆(smsCode)、读取手机SIM卡一键登陆(univerify)、账号密码登陆(username)、微信登陆(weixin)、苹果登陆(apple)
- 使用方式:在 `uni-starter.config.js`->`router`->`login`下完全列举你需要的登陆方式。这里支持用[条件编译](https://uniapp.dcloud.io/platform?id=%e6%9d%a1%e4%bb%b6%e7%bc%96%e8%af%91)因此你可以配置在不同平台下拥有的登陆方式。
- 优先级策略:根据配置的第0项为第一优先级。
- 优先级策略:
如果:配置内容为:["username","smsCode"],用户执行如下代码:
```
uni.navigateTo({
url: "/pages/ucenter/login-page/index/index"
})
```
访问登陆页面,但会被拦截器自动切换到“配置的第0项的登陆方式对应的页面”,即账户登陆方式页面,路径:`/pages/ucenter/login-page/pwd-login/pwd-login`
- 生效策略:未列举到的或设备环境不支持的登陆方式将被隐藏。
- 配置:
+ uni-starter服务端使用[uni-config-center](https://ext.dcloud.net.cn/plugin?id=4425)统一管理这些配置,详情下文[目录结构](#id=catalogue)
+ `manifest.json` App模块配置 --> OAuth(登录鉴权)--> 勾选并配置你所需要的模块
+ 服务端:uni-starter服务端使用[uni-config-center](https://ext.dcloud.net.cn/plugin?id=4425)统一管理这些配置,详情下文[目录结构](#id=catalogue)
+ 应用模块:`manifest.json` App模块配置 --> OAuth(登录鉴权)--> 勾选并配置你所需要的模块
#### 3.h5版在页面顶部引导用户`点击下载App`
- 把h5端用户引流到APP端是一个非常常用的功能,相对于h5,APP端有更高的用户留存和更好的产品体验。
-跟是一个演示开发者如何在h5端做全局悬浮块。你可以在`/common/openApp.js`中修改他的样式等代码等,注意他只支持普通js语法。
-同时也是一个演示开发者如何在h5端做全局悬浮块的例子。你可以在`/common/openApp.js`中修改他的样式等代码等,注意他只支持普通js语法。
#### 4.分享模块
- `manifest.json` App模块配置 --> Share(分享)--> 勾选并配置你所需要的模块
- 应用配置:`manifest.json` App模块配置 --> Share --> 勾选并配置你所需要的模块
- 分享功能配置参数,随着应用的业务场景决定,在各场景调用的时候配置。参考uni-starter的`/pages/list/detail.vue``methods -> shareClick`
- 更多`uni-share`的介绍 [详情](https://ext.dcloud.net.cn/plugin?id=4860)
#### 5.升级中心相关
- `manifest.json` 基础配置 --> 应用版本名称 和 应用版本号
- 更多`uni-upgrade-center`的介绍 [详情](https://uniapp.dcloud.io/uniCloud/upgrade-center)
为了解决开发者维护多个 App 升级繁琐,重复逻辑过多,管理不便的问题,升级中心`uni-upgrade-center`应运而生。
提供了简单、易用、统一的 App 管理、App 版本管理、安装包发布管理,升级检测更新管理。
- 升级中心分为两个部分:`uni-upgrade-center` Admin管理后台和`uni-upgrade-center-app`前台检测更新。
- `uni-upgrade-center`的介绍 [详情](https://ext.dcloud.net.cn/plugin?id=4542)
- `uni-upgrade-center-app`的介绍 [详情](https://ext.dcloud.net.cn/plugin?id=4470)
#### 6.指纹识别模块
- `manifest.json` App模块配置 --> `Fingerprint`指纹识别
......@@ -117,6 +128,10 @@ img{
#### 7.消息推送模块
- `manifest.json` App模块配置 --> `push`消息推送
#### 8.意见反馈
- 客户端[详情](https://ext.dcloud.net.cn/plugin?id=50)
- admin端[详情](https://ext.dcloud.net.cn/plugin?id=4992)
### 应用启动时序介绍
文件路径: App.vue
```
......
......@@ -61,22 +61,7 @@
"navigationStyle": "custom"
}
}, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/list",
"style": {
"navigationBarTitleText": "常见问题"
}
}, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/add",
"style": {
"navigationBarTitleText": "问题反馈"
}
}, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/detail",
"style": {
"navigationBarTitleText": "问题反馈"
}
}, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/edit",
"path": "uni_modules/uni-feedback/pages/uni-feedback/add",
"style": {
"navigationBarTitleText": "问题反馈"
}
......
......@@ -14,10 +14,10 @@
</uni-grid>
<uni-list class="center-list" v-for="(sublist , index) in ucenterList" :key="index">
<uni-list-item v-for="(item,i) in sublist" :title="item.title" link :rightText="item.rightText" :key="i"
:clickable="true" :to="item.to"
@click="ucenterListClick(item)"
:show-extra-icon="true"
:extraIcon="{type:item.icon,color:'#999'}"
:clickable="true" :to="item.to"
@click="ucenterListClick(item)"
:show-extra-icon="true"
:extraIcon="{type:item.icon,color:'#999'}"
>
<view v-if="item.showBadge" class="item-footer" slot="footer">
<text class="item-footer-text">{{item.rightText}}</text>
......@@ -64,34 +64,34 @@
// #ifdef APP-PLUS
{
"title": '去评分',
"event": 'gotoMarket',
"event": 'gotoMarket',
"icon":"hand-thumbsup"
},
//#endif
{
"title": '阅读过的文章',
"to": '/pages/ucenter/read-news-log/read-news-log',
"to": '/pages/ucenter/read-news-log/read-news-log',
"icon":"flag"
},
{
"title": '我的积分',
"to": '',
"event": 'getScore',
"event": 'getScore',
"icon":"paperplane"
}
],
[{
"title": '问题与反馈',
"to": '/uni_modules/opendb-feedback/pages/opendb-feedback/add',
"to": '/uni_modules/uni-feedback/pages/uni-feedback/add',
"icon":"help"
}, {
"title": '设置',
"to": '/pages/ucenter/settings/settings',
"to": '/pages/ucenter/settings/settings',
"icon":"gear"
}],
[{
"title": '关于',
"to": '/pages/ucenter/about/about',
"to": '/pages/ucenter/about/about',
"icon":"info"
}]
]
......@@ -102,7 +102,7 @@
this.ucenterList[this.ucenterList.length - 2].unshift({
title: '检查更新',
rightText: this.appVersion.version + '-' + this.appVersion.versionCode,
event: 'checkVersion',
event: 'checkVersion',
icon:'loop',
showBadge: this.appVersion.hasNew
})
......@@ -229,7 +229,7 @@
width: 750rpx;
padding: 20rpx;
padding-top: 50px;
background-image: url(../../static/uni-center/headers.png);
background-image: url(../../static/uni-center/headers.png);
flex-direction: column;
align-items: center;
}
......@@ -267,13 +267,13 @@
.grid {
background-color: #FFFFFF;
margin-bottom: 15rpx;
margin-bottom: 15rpx;
padding: 10rpx 0;
}
.uni-grid .text {
font-size: 30rpx;
height: 30px;
font-size: 30rpx;
height: 30px;
line-height: 30px;
color: #817f82;
}
......
......@@ -24,7 +24,7 @@ module.exports = {
"/pages/ucenter/userinfo/userinfo",
"/uni_modules/uni-news-favorite/pages/uni-news-favorite/list",
"/pages/ucenter/userinfo/uploadCutImageToUnicloud",
"/uni_modules/opendb-feedback/pages/opendb-feedback/add"
"/uni_modules/uni-feedback/pages/uni-feedback/add"
],
"login": ["smsCode","univerify", "username", "weixin", "apple"],
/*
......
{
"pages": [
{
"path": "pages/opendb-feedback/add",
"style": {
"navigationBarTitleText": "新增"
}
},
{
"path": "pages/opendb-feedback/edit",
"style": {
"navigationBarTitleText": "编辑"
}
},
{
"path": "pages/opendb-feedback/list",
"style": {
"navigationBarTitleText": "列表"
}
},
{
"path": "pages/opendb-feedback/detail",
"style": {
"navigationBarTitleText": "详情"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
}
\ No newline at end of file
<template>
<view class="container">
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" :options="options" collection="opendb-feedback" field="content,imgs,contact,mobile" :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.content}}</text>
</view>
<view>
<text>图片列表:</text>
<template v-for="(file, j) in data.imgs"> <uni-file-picker v-if="file.fileType == 'image'" :value="file" :file-mediatype="file.fileType" readonly></uni-file-picker> <uni-link v-else :href="file.url" :text="file.url"></uni-link> </template>
</view>
<view>
<text>联系人:</text>
<text>{{data.contact}}</text>
</view>
<view>
<text>联系电话:</text>
<text>{{data.mobile}}</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/opendb-feedback.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: './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: './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="uni-container">
<uni-forms ref="form" :value="formData" validate-trigger="submit" err-show-type="toast">
<uni-forms-item name="content" label="留言内容/回复内容" required>
<textarea @input="binddata('content', $event.detail.value)" class="uni-textarea-border" :value="formData.content" trim="right"></textarea>
</uni-forms-item>
<uni-forms-item name="imgs" label="图片列表">
<uni-file-picker file-mediatype="image" :limit="6" return-type="array" v-model="formData.imgs" />
</uni-forms-item>
<uni-forms-item name="contact" label="联系人">
<uni-easyinput v-model="formData.contact" trim="both" />
</uni-forms-item>
<uni-forms-item name="mobile" label="联系电话">
<uni-easyinput v-model="formData.mobile" 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/opendb-feedback.js';
const db = uniCloud.database();
const dbCollectionName = 'opendb-feedback';
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: {
"content": "",
"imgs": [],
"contact": "",
"mobile": ""
},
formOptions: {},
rules: {
...getValidator(["content","imgs","contact","mobile"])
}
}
},
onLoad(e) {
const id = e.id
this.formDataId = id
this.getDetail(id)
},
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).doc(this.formDataId).update(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()
})
},
/**
* 获取表单数据
* @param {Object} id
*/
getDetail(id) {
uni.showLoading({
mask: true
})
db.collection(dbCollectionName).doc(id).field('content,imgs,is_reply,feedback_id,contact,mobile').get().then((res) => {
const data = res.result.data[0]
if (data) {
this.formData = data
}
}).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, pagination, loading, hasMore, error}" collection="opendb-feedback"
field="content, title" where="is_reply == false" @load="isLoading == false" @error="isLoading == false">
<view v-if="data && data.length">
<uni-collapse :accordion="true">
<uni-collapse-item v-for="(item, index) in data" :key="index" :title="item.title" :show-animation="true">
<text class="content">{{ item.content }}</text>
</uni-collapse-item>
</uni-collapse>
</view>
</unicloud-db>
<uni-fab ref="fab" horizontal="right" vertical="bottom" :pop-menu="false" @fabClick="fabClick" />
</view>
</template>
<script>
export default {
data() {
return {
isLoading:true,
}
},
methods: {
refreshData() {
this.$refs.udb.loadData({
clear: true
}, (res) => {
console.log(res);
})
},
fabClick() {
// 打开新增页面
uni.navigateTo({
url: './add',
events: {
// 监听新增数据成功后, 刷新当前页面数据
refreshData: () => {
this.$refs.udb.loadData({
clear: true
})
}
}
})
}
}
}
</script>
<style>
.content{
padding: 20rpx;
}
</style>
## 1.0.0(2021-05-11)
升级为云端一体模板
{
"id": "uni-feedback",
"displayName": "问题反馈页面模板",
"version": "1.0.0",
"description": "问题反馈页面模板,方便开发者快速搭建问题反馈界面",
"keywords": [
"问题反馈页面模板"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"uniCloud",
"云端一体页面模板"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
\ No newline at end of file
......@@ -25,7 +25,7 @@
<script>
import {
validator
} from '../../js_sdk/validator/opendb-feedback.js';
} from '../../js_sdk/validator/uni-feedback.js';
const db = uniCloud.database();
const dbCollectionName = 'opendb-feedback';
......@@ -76,14 +76,14 @@
submitForm(value) {
// 使用 clientDB 提交数据
db.collection(dbCollectionName).add(value).then((res) => {
uni.showModal({
content: '提交成功,感谢您的反馈!',
showCancel: false,
confirmText:"关闭",
complete:()=>{
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}
uni.showModal({
content: '提交成功,感谢您的反馈!',
showCancel: false,
confirmText:"关闭",
complete:()=>{
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}
});
}).catch((err) => {
uni.showModal({
......@@ -143,4 +143,4 @@
.uni-container /deep/ .uni-file-picker__container {
flex-direction: row;
}
</style>
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册