suggest.vue
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
<view class="page">
<textarea class="textarea" v-model="txt" maxlength="300" placeholder="可以提出您想实现的彩店功能、或者对现有产品的改进"></textarea>
<button type="default" class="btn" @click="save">提交</button>
</view>
</template>
<script>
export default {
data() {
return {
txt: ''
}
},
async onLoad(e) {},
methods: {
async save() {
let txt = this.txt.trim()
if (txt.length < 20) {
uni.showToast({
icon: 'error',
title: '您描述的问题内容太少'
})
return
}
const res = await uni.$u.request.graphql({
type: 'mutation',
name: 'suggestAdd',
args: `url:"",img:"",typeId:5,content:"${txt}"`
})
if (res.Error) {
uni.showToast({
icon: 'error',
title: res.Error
})
return
}
uni.showToast({
title: '提交成功'
})
this.txt = ''
}
}
}
</script>
<style lang="scss" scoped>
body {
max-width: $sys-max-width;
-webkit-tap-highlight-color: transparent;
box-shadow: 0 2px 2px rgb(0 0 0 / 30%);
}
.page {
width: 100%;
height: 100vh;
background-color: #F1F1F1;
font-size: 14px;
}
.textarea {
width: calc(100% - 20px);
padding: 10px;
min-height: 150px;
background-color: #FFFFFF;
}
.btn {
height: 44px;
margin: 20px 10px;
background-color: #D23338;
color: #FFFFFF;
}
</style>