feedback.vue 7.9 KB

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