feedback.vue 7.2 KB

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