Skip to content

Commit

Permalink
增加用户反馈功能
Browse files Browse the repository at this point in the history
  • Loading branch information
gooking committed Sep 23, 2022
1 parent ff84326 commit 2dc9951
Show file tree
Hide file tree
Showing 8 changed files with 440 additions and 13 deletions.
2 changes: 1 addition & 1 deletion App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
goLogin: false,
subDomain: 'hdldzpd', // 改为你自己的专属域名
merchantId: 29, // 改为你自己的商户ID
version: '0.0.1',
version: '1.0.0',
sysconfigkeys: 'mallName', // 需要批量读取的系统参数
wxpayOpenAppId: 'xxxxx', // 微信开放平台的移动端应用appID
openAlipayProvider: false, // 是否开通支付宝支付
Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,34 @@
| :------:
| <img src="https://dcdn.it120.cc/2022/09/23/b77d3177-5ef7-4d9e-9804-0a7a6a0f4a62.png" width="250px">

# 特别感谢
| 用户反馈 | 订座
| :------: | :------: |
| <img src="https://dcdn.it120.cc/2022/09/23/c8512fe5-87ce-4af2-b506-509932ac4668.png" width="250px"> | <img src="https://dcdn.it120.cc/2022/09/23/5bac846d-d9a5-48e9-b965-e60f69a33f85.png" width="250px"> |

## 关于后端

本项目是基于 “api工厂” 开放的前端api接口开发的纯前端项目,你也可以直接使用“api工厂”作为你的后端及服务器,也可以选择自行开发后端。

如果你也是使用的“api工厂”,可以将我的测试数据克隆过去,可以更加方便的进行测试及开发【商户ID填 29 即可】:

<img src="https://dcdn.it120.cc/2022/09/23/3c890fa9-bfc0-4ba0-9dac-60cb6315cb1e.png" width="500px">

## 特别感谢

- [uni-app 使得多端开发更简单](hhttps://uniapp.dcloud.io/)
- [uview2.0 全面的组件和便捷的工具会让您信手拈来,如鱼得水](https://www.uviewui.com/)
- [api工厂 前端大中台 更加专注前端开发](https://www.it120.cc/)
- [api工厂-SDK](https://www.yuque.com/apifm/nu0f75)

## 加我微信

<img src="https://dcdn.it120.cc/2021/06/23/3cf5a664-90d8-484f-9652-ef4ca46a926d.jpeg" width="250px">

# 微信交流群
## 微信交流群

<img src="https://dcdn.it120.cc/2022/09/18/5d107e9f-084c-4aff-a786-e989d4c549fc.png" width="250px">

# 诚邀请一起来开发
## 诚邀请一起来开发

1. 右上角 “Star” 点击鼓励
2. 右上角 “Fork” ,将代码复制一个副本到你自己的 Git 账号下
Expand Down
8 changes: 3 additions & 5 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name" : "仿海底捞订座排队",
"appid" : "__UNI__1EDBDA0",
"description" : "仿海底捞订座排队",
"versionName" : "0.0.1",
"versionCode" : 1,
"versionName" : "1.0.0",
"versionCode" : 100,
"transformPx" : false,
"app-plus" : {
"optimization" : {
Expand Down Expand Up @@ -135,9 +135,7 @@
"subPackages" : true
},
"usingComponents" : true,
"requiredPrivateInfos": [
"getLocation"
],
"requiredPrivateInfos" : [ "getLocation" ],
"permission" : {
"scope.userLocation" : {
"desc" : "为你推荐附近的门店"
Expand Down
6 changes: 6 additions & 0 deletions node_modules/apifm-uniapp/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@
"style": {
"navigationBarTitleText": "订座成功"
}
},
{
"path" : "pages/fankui/index",
"style": {
"navigationBarTitleText": "吐个槽"
}
},
{
"path" : "pages/fankui/add",
"style": {
"navigationBarTitleText": "吐个槽"
}
}
],
"globalStyle": {
Expand Down
272 changes: 272 additions & 0 deletions pages/fankui/add.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
<template>
<view v-if="nickStatus != 0 && avatarUrlStatus != 0">
<view v-if="nickStatus == 1" class="setnick">
<view class="title">设置您的昵称</view>
<view class="input">
<u-input type="nickname" placeholder="如何称呼您?" v-model="nick" clearable focus inputAlign="center"></u-input>
</view>
<view class="btn">
<u-button type="success" size="large" shape="circle" text="设置昵称" @click="saveNick"></u-button>
</view>
</view>
<view v-else-if="avatarUrlStatus == 1" class="setnick">
<view class="title">设置您的头像</view>
<view class="input">
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="avatarUrl" mode="aspectFill"></image>
</button>
</view>
<view class="btn">
<u-button type="success" size="large" shape="circle" text="设置头像" @click="saveAvatar"></u-button>
</view>
</view>
<view v-else-if="mobileStatus == 1" class="setnick">
<view class="title">请先登陆</view>
<view class="btn">
<u-button type="success" size="large" shape="circle" text="一键登陆" openType="getPhoneNumber" @getphonenumber="getPhoneNumber"></u-button>
</view>
</view>
<view v-else>
<view class="form-box">
<u-textarea v-model="content" clearable placeholder="请留下您的宝贵建议或意见~"></u-textarea>
<view class="upload">
<u-upload :fileList="fileList" maxCount="9" width="100" @afterRead="afterRead" @delete="deletePic" accept="image" multiple uploadText="上传图片"></u-upload>
</view>
</view>
<view class="submit-btn">
<u-button type="success" @click="submit">提交反馈</u-button>
</view>
</view>
</view>
</template>

<script>
export default {
data() {
return {
nickStatus: 0, // 0 未查询,1 未设置昵称,2 已设置
avatarUrlStatus: 0, // 0 未查询,1 未设置头像,2 已设置
mobileStatus: 0, // 0 未判断; 1 未绑定手机好吗; 2 已绑定手机号码
nick: undefined,
avatarUrl: undefined,
content: undefined,
fileList: [],
balance: 0.00,
rules: {
name: [{
required: true,
message: '不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
mobile: [{
required: true,
message: '不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
content: [{
required: true,
message: '不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
},
form: {
name: null,
mobile: null,
wx: null,
content: null,
},
}
},
created() {
},
mounted() {
},
onReady() {
// this.$refs.uForm.setRules(this.rules)
this._userDetail()
},
onLoad(e) {},
onShow() {
},
methods: {
async _userDetail() {
// https://www.yuque.com/apifm/nu0f75/zgf8pu
const res = await this.$wxapi.userDetail(this.token)
if (res.code == 0) {
if (res.data.base.nick) {
this.nickStatus = 2
} else {
this.nickStatus = 1
}
if (res.data.base.avatarUrl) {
this.avatarUrlStatus = 2
} else {
this.avatarUrlStatus = 1
}
if (res.data.base.mobile) {
this.mobileStatus = 2
} else {
this.mobileStatus = 1
}
}
},
async saveNick() {
if (!this.nick) {
uni.showToast({
title: '请输入昵称',
icon: 'none'
})
return
}
// https://www.yuque.com/apifm/nu0f75/ykr2zr
const res = await this.$wxapi.modifyUserInfo({
token: this.token,
nick: this.nick
})
if (res.code != 0) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
uni.showToast({
title: '设置成功',
icon:'success'
})
this.nickStatus = 2
},
onChooseAvatar(e) {
this.avatarUrl = e.detail.avatarUrl
},
async saveAvatar() {
if (!this.avatarUrl) {
uni.showToast({
title: '请选择头像',
icon: 'none'
})
return
}
let res = await this.$wxapi.uploadFile(this.token, this.avatarUrl)
if (res.code != 0) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
// https://www.yuque.com/apifm/nu0f75/ykr2zr
res = await this.$wxapi.modifyUserInfo({
token: this.token,
avatarUrl: res.data.url
})
if (res.code != 0) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
uni.showToast({
title: '设置成功',
icon:'success'
})
this.avatarUrlStatus = 2
},
async getPhoneNumber(e) {
if (!e.detail.errMsg || e.detail.errMsg != "getPhoneNumber:ok") {
console.error(e)
return
}
const res = await this.$wxapi.bindMobileWxappV2(this.token, e.detail.code)
if (res.code == 0) {
uni.showToast({
title: '登陆成功',
icon: 'success',
duration: 2000
})
this.$u.vuex('mobile', res.data)
this.mobileStatus = 2
} else {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
})
}
},
async afterRead(event) {
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
this.fileList = this.fileList.concat(event.file)
},
deletePic(event) {
this.fileList.splice(event.index, 1)
},
async submit() {
const extJsonStr = {}
// 批量上传附件
if (this.fileList) {
for (let index = 0; index < this.fileList.length; index++) {
const pic = this.fileList[index];
const res = await this.$wxapi.uploadFile(this.token, pic.url)
if (res.code == 0) {
extJsonStr['file' + index] = res.data.url
}
}
}
const res = await this.$wxapi.addComment({
token: this.token,
type: 1,
extJsonStr: JSON.stringify(extJsonStr),
content: this.content
})
if (res.code == 0) {
uni.showModal({
showCancel: false,
title: '成功',
content: '提交成功',
confirmText: '知道了',
success: () => {
uni.navigateBack()
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
},
}
}
</script>
<style scoped lang="scss">
.upload {
margin-top: 32rpx;
}
.setnick {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
.title {
color: #333;
font-size: 58rpx;
font-weight: bold;
text-align: center;
}
.input {
padding: 32rpx 64rpx;
}
}
.btn {
padding: 64rpx;
}
</style>
Loading

0 comments on commit 2dc9951

Please sign in to comment.