feedback.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="page" style="background: #FFFFFF;" v-if="shangxian!='是'">
  3. <view class="feedback-title">
  4. <view>问题和意见</view>
  5. <view class="feedback-quick" @tap="chooseMsg">
  6. <text class="margin-right-xs">快速键入</text>
  7. <image src="../../static/my/icon_go.png" style="width: 11rpx;height: 20rpx;"></image>
  8. </view>
  9. </view>
  10. <view class="feedback-body"><textarea placeholder="请详细描述你的问题和意见..." v-model="sendDate.content"
  11. class="feedback-textare" /></view>
  12. <view class="feedback-title"><text>QQ/邮箱</text></view>
  13. <view class="feedback-body"><input class="feedback-input" v-model="sendDate.contact" placeholder="方便我们联系你 " />
  14. </view>
  15. <view class="feedback-title feedback-star-view">
  16. <text>应用评分:</text>
  17. <view>
  18. <u-rate :count="count" v-model="value"></u-rate>
  19. <!-- <u-rate :count="count" v-model="value" active-color="#FA3534" inactive-color="#b2b2b2" active-icon="star-fill"></u-rate> -->
  20. <!-- <u-rate :count="count" v-model="value" active-color="#FA3534" inactive-color="#b2b2b2"></u-rate> -->
  21. </view>
  22. <!-- <view class="feedback-star-view">
  23. <text class="feedback-star" v-for="(value, key) in stars" :key="key" :class="key < sendDate.score ? 'active' : ''" @tap="chooseStar(value)"></text>
  24. </view> -->
  25. </view>
  26. <button type="primary" style="background: #346EF6" class="feedback-submit" @tap="send">提交</button>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. msgContents: ['界面显示错乱', '启动缓慢,卡出翔了', 'UI无法直视,丑哭了', '偶发性崩溃'],
  34. // stars: [1, 2, 3, 4, 5],
  35. count: 5,
  36. value:0,
  37. imageList: [],
  38. sendDate: {
  39. score: 0,
  40. content: '',
  41. contact: ''
  42. },
  43. shangxian: '是',
  44. };
  45. },
  46. onLoad() {
  47. this.shangxian = uni.getStorageSync('shangxian')
  48. if(this.shangxian=='否'){
  49. uni.setNavigationBarTitle({
  50. title:'意见反馈'
  51. })
  52. }else{
  53. uni.setNavigationBarTitle({
  54. title:'用户协议'
  55. })
  56. }
  57. // let deviceInfo = {
  58. // appid: plus.runtime.appid,
  59. // imei: plus.device.imei, //设备标识
  60. // p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型,i表示iOS平台,a表示Android平台。
  61. // md: plus.device.model, //设备型号
  62. // app_version: plus.runtime.version,
  63. // plus_version: plus.runtime.innerVersion, //基座版本号
  64. // os: plus.os.version,
  65. // net: '' + plus.networkinfo.getCurrentType()
  66. // };
  67. // this.sendDate = Object.assign(deviceInfo, this.sendDate);
  68. },
  69. methods: {
  70. onChange(e){
  71. console.log(e)
  72. this.sendDate.score = e.value
  73. },
  74. close(e) {
  75. this.imageList.splice(e, 1);
  76. },
  77. chooseMsg() {
  78. //快速输入
  79. uni.showActionSheet({
  80. itemList: this.msgContents,
  81. success: res => {
  82. this.sendDate.content = this.msgContents[res.tapIndex];
  83. }
  84. });
  85. },
  86. chooseImg() {
  87. //选择图片
  88. uni.chooseImage({
  89. sourceType: ['camera', 'album'],
  90. sizeType: 'compressed',
  91. count: 8 - this.imageList.length,
  92. success: res => {
  93. this.imageList = this.imageList.concat(res.tempFilePaths);
  94. }
  95. });
  96. },
  97. // chooseStar(e) {
  98. // //点击评星
  99. // this.sendDate.score = e;
  100. // },
  101. // previewImage() {
  102. // //预览图片
  103. // uni.previewImage({
  104. // urls: this.imageList
  105. // });
  106. // },
  107. send() {
  108. //发送反馈
  109. console.log(JSON.stringify(this.sendDate), '11111');
  110. if (!this.sendDate.content) {
  111. uni.showToast({
  112. icon: 'none',
  113. title: '请输入反馈内容'
  114. });
  115. return;
  116. }
  117. if (!this.sendDate.contact) {
  118. uni.showToast({
  119. icon: 'none',
  120. title: '请填写QQ或邮箱'
  121. });
  122. return;
  123. }
  124. // uni.report( this.sendDate,'意见反馈');
  125. // console.log("uni.report( '意见反馈',this.sendDate)", uni.report('意见反馈', this.sendDate))
  126. // uni.report('意见反馈', this.sendDate);
  127. this.$queue.showLoading('加载中...');
  128. this.$Request.postJson('/app/message/insertMessage', {
  129. title: this.sendDate.contact,
  130. content: JSON.stringify(this.sendDate),
  131. state: 2
  132. }).then(res => {
  133. if (res.code === 0) {
  134. uni.showToast({
  135. title: '反馈成功'
  136. });
  137. setTimeout(function() {
  138. uni.navigateBack();
  139. }, 1000);
  140. } else {
  141. uni.hideLoading();
  142. uni.showModal({
  143. showCancel: false,
  144. title: '反馈失败',
  145. content: res.msg
  146. });
  147. }
  148. });
  149. }
  150. }
  151. };
  152. </script>
  153. <style>
  154. /* @font-face {
  155. font-family: uniicons;
  156. font-weight: normal;
  157. font-style: normal;
  158. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  159. } */
  160. page {
  161. background-color: #FFFFFF;
  162. }
  163. view {
  164. font-size: 28upx;
  165. }
  166. .input-view {
  167. font-size: 28upx;
  168. }
  169. .close-view {
  170. text-align: center;
  171. line-height: 14px;
  172. height: 16px;
  173. width: 16px;
  174. border-radius: 50%;
  175. background: #ff5053;
  176. color: #ffffff;
  177. position: absolute;
  178. top: -6px;
  179. right: -4px;
  180. font-size: 12px;
  181. }
  182. /* 上传 */
  183. .uni-uploader {
  184. flex: 1;
  185. flex-direction: column;
  186. }
  187. .uni-uploader-head {
  188. display: flex;
  189. flex-direction: row;
  190. justify-content: space-between;
  191. }
  192. .uni-uploader-info {
  193. color: #b2b2b2;
  194. }
  195. .uni-uploader-body {
  196. margin-top: 16upx;
  197. }
  198. .uni-uploader__files {
  199. display: flex;
  200. flex-direction: row;
  201. flex-wrap: wrap;
  202. }
  203. .uni-uploader__file {
  204. margin: 10upx;
  205. width: 210upx;
  206. height: 210upx;
  207. }
  208. .uni-uploader__img {
  209. display: block;
  210. width: 210upx;
  211. height: 210upx;
  212. }
  213. .uni-uploader__input-box {
  214. position: relative;
  215. margin: 10upx;
  216. width: 208upx;
  217. height: 208upx;
  218. border: 2upx solid #d9d9d9;
  219. }
  220. .uni-uploader__input-box:before,
  221. .uni-uploader__input-box:after {
  222. content: ' ';
  223. position: absolute;
  224. top: 50%;
  225. left: 50%;
  226. -webkit-transform: translate(-50%, -50%);
  227. transform: translate(-50%, -50%);
  228. background-color: #d9d9d9;
  229. }
  230. .uni-uploader__input-box:before {
  231. width: 4upx;
  232. height: 79upx;
  233. }
  234. .uni-uploader__input-box:after {
  235. width: 79upx;
  236. height: 4upx;
  237. }
  238. .uni-uploader__input-box:active {
  239. border-color: #999999;
  240. }
  241. .uni-uploader__input-box:active:before,
  242. .uni-uploader__input-box:active:after {
  243. background-color: #999999;
  244. }
  245. .uni-uploader__input {
  246. position: absolute;
  247. z-index: 1;
  248. top: 0;
  249. left: 0;
  250. width: 100%;
  251. height: 100%;
  252. opacity: 0;
  253. }
  254. /*问题反馈*/
  255. .feedback-title {
  256. display: flex;
  257. flex-direction: row;
  258. justify-content: space-between;
  259. align-items: center;
  260. padding: 20upx;
  261. color: #8f8f94;
  262. font-size: 28upx;
  263. }
  264. .feedback-star-view.feedback-title {
  265. justify-content: flex-start;
  266. margin: 0;
  267. }
  268. .feedback-quick {
  269. /* position: relative; */
  270. /* padding-right: 40upx; */
  271. }
  272. /* .feedback-quick:after {
  273. font-family: uniicons;
  274. font-size: 40upx;
  275. content: '\e581';
  276. position: absolute;
  277. right: 0;
  278. top: 50%;
  279. color: #bbb;
  280. -webkit-transform: translateY(-50%);
  281. transform: translateY(-50%);
  282. } */
  283. .feedback-body {
  284. font-size: 32upx;
  285. padding: 16upx;
  286. margin: 16upx;
  287. border-radius: 16upx;
  288. background: #F8F8F8;
  289. }
  290. .feedback-textare {
  291. height: 200upx;
  292. font-size: 34upx;
  293. line-height: 50upx;
  294. width: 100%;
  295. box-sizing: border-box;
  296. padding: 0upx 10upx 0;
  297. }
  298. .feedback-input {
  299. font-size: 32upx;
  300. height: 60upx;
  301. margin: 6upx 10upx;
  302. line-height: 60upx;
  303. }
  304. .feedback-uploader {
  305. padding: 22upx 20upx;
  306. }
  307. .feedback-star {
  308. font-family: uniicons;
  309. font-size: 40upx;
  310. margin-left: 6upx;
  311. }
  312. .feedback-star-view {
  313. margin-left: 20upx;
  314. }
  315. .feedback-star:after {
  316. content: '\e408';
  317. }
  318. .feedback-star.active {
  319. color: #ffb400;
  320. }
  321. .feedback-star.active:after {
  322. content: '\e438';
  323. }
  324. .feedback-submit {
  325. background: #007aff;
  326. color: #ffffff;
  327. margin: 20upx;
  328. }
  329. </style>