index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="page-box">
  3. <navBar title="我要反馈" color="#000" />
  4. <view class="page-content">
  5. <view class="page" style="background-color: #ffffff">
  6. <view class="feedback-title">
  7. <text>问题和意见</text>
  8. <text @tap="chooseMsg">快速键入</text>
  9. </view>
  10. <view class="feedback-body">
  11. <textarea
  12. placeholder="请详细描述你的问题和意见..."
  13. v-model="sendDate.content"
  14. class="feedback-textare"
  15. />
  16. </view>
  17. <view class="feedback-title"><text>联系方式</text></view>
  18. <view class="feedback-body"
  19. ><input
  20. class="feedback-input"
  21. v-model="sendDate.contact"
  22. placeholder="方便我们联系你 "
  23. />
  24. </view>
  25. <button style="" class="feedback-submit" @tap="send">提交</button>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import navBar from "@/components/nav-bar/index.vue";
  32. export default {
  33. data() {
  34. return {
  35. msgContents: [
  36. "界面显示错乱",
  37. "启动缓慢,卡出翔了",
  38. "UI无法直视,丑哭了",
  39. "偶发性崩溃",
  40. ],
  41. stars: [1, 2, 3, 4, 5],
  42. imageList: [],
  43. sendDate: {
  44. score: 5,
  45. content: "",
  46. contact: "",
  47. },
  48. };
  49. },
  50. components: {
  51. navBar,
  52. },
  53. onLoad() {
  54. let deviceInfo = {
  55. appid: plus.runtime.appid,
  56. imei: plus.device.imei, //设备标识
  57. p: plus.os.name === "Android" ? "a" : "i", //平台类型,i表示iOS平台,a表示Android平台。
  58. md: plus.device.model, //设备型号
  59. app_version: plus.runtime.version,
  60. plus_version: plus.runtime.innerVersion, //基座版本号
  61. os: plus.os.version,
  62. net: "" + plus.networkinfo.getCurrentType(),
  63. };
  64. this.sendDate = Object.assign(deviceInfo, this.sendDate);
  65. },
  66. methods: {
  67. close(e) {
  68. this.imageList.splice(e, 1);
  69. },
  70. chooseMsg() {
  71. //快速输入
  72. uni.showActionSheet({
  73. itemList: this.msgContents,
  74. success: (res) => {
  75. this.sendDate.content = this.msgContents[res.tapIndex];
  76. },
  77. });
  78. },
  79. chooseImg() {
  80. // // 1. 先判断系统类型,区分Android/iOS权限
  81. // const systemInfo = uni.getSystemInfoSync();
  82. // const isAndroid = systemInfo.system.includes('Android');
  83. // const permissionType = isAndroid ? 'storage' : 'photos'; // Android=存储,iOS=相册
  84. // // 2. 权限检查(复用之前封装的 checkPermission 函数)
  85. // const hasPermission = this.$queue.checkPermission(
  86. // permissionType,
  87. // isAndroid
  88. // ? '选择/拍摄照片需要相机/相册权限,用于上传简历/求职资料' // Android 专属提示
  89. // : '选择/拍摄照片需要相机/相册权限,用于上传简历/求职资料'
  90. // );
  91. // if (!hasPermission) {
  92. // uni.showToast({ title: '未获取权限,无法选择照片', icon: 'none' });
  93. // return;
  94. // }
  95. //选择图片
  96. uni.chooseImage({
  97. sourceType: ["camera", "album"],
  98. sizeType: "compressed",
  99. count: 8 - this.imageList.length,
  100. success: (res) => {
  101. this.imageList = this.imageList.concat(res.tempFilePaths);
  102. },
  103. });
  104. },
  105. chooseStar(e) {
  106. //点击评星
  107. this.sendDate.score = e;
  108. },
  109. previewImage() {
  110. //预览图片
  111. uni.previewImage({
  112. urls: this.imageList,
  113. });
  114. },
  115. send() {
  116. //发送反馈
  117. console.log(JSON.stringify(this.sendDate));
  118. if (!this.sendDate.content) {
  119. uni.showToast({
  120. icon: "none",
  121. title: "请输入反馈内容",
  122. });
  123. return;
  124. }
  125. if (!this.sendDate.contact) {
  126. uni.showToast({
  127. icon: "none",
  128. title: "请填写QQ或邮箱",
  129. });
  130. return;
  131. }
  132. this.$queue.showLoading("加载中...");
  133. this.$Request
  134. .postJson("/app/message/insertMessage", {
  135. title: this.sendDate.contact,
  136. content: JSON.stringify(this.sendDate),
  137. state: 2,
  138. })
  139. .then((res) => {
  140. if (res.code === 0) {
  141. uni.showToast({
  142. title: "投诉成功",
  143. });
  144. setTimeout(function () {
  145. uni.navigateBack();
  146. }, 1000);
  147. } else {
  148. uni.hideLoading();
  149. uni.showModal({
  150. showCancel: false,
  151. title: "投诉失败",
  152. content: res.msg,
  153. });
  154. }
  155. });
  156. },
  157. },
  158. };
  159. </script>
  160. <style lang="scss" scoped>
  161. @font-face {
  162. font-family: uniicons;
  163. font-weight: normal;
  164. font-style: normal;
  165. src: url("https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf") format("truetype");
  166. }
  167. page {
  168. .page-box {
  169. position: absolute;
  170. left: 0;
  171. bottom: 0;
  172. right: 0;
  173. top: 0;
  174. overflow: hidden;
  175. display: flex;
  176. flex-direction: column;
  177. .page-content {
  178. flex: 1;
  179. overflow: hidden;
  180. overflow-y: auto;
  181. }
  182. }
  183. }
  184. view {
  185. font-size: 28upx;
  186. }
  187. /*问题反馈*/
  188. .feedback-title {
  189. display: flex;
  190. flex-direction: row;
  191. justify-content: space-between;
  192. align-items: center;
  193. padding: 20upx;
  194. color: #8f8f94;
  195. font-size: 28upx;
  196. }
  197. .feedback-star-view.feedback-title {
  198. justify-content: flex-start;
  199. margin: 0;
  200. }
  201. .feedback-body {
  202. font-size: 32upx;
  203. padding: 16upx;
  204. margin: 16upx;
  205. border-radius: 16upx;
  206. background: #ffffff;
  207. /* color: #FFF; */
  208. }
  209. .feedback-textare {
  210. height: 200upx;
  211. font-size: 34upx;
  212. line-height: 50upx;
  213. width: 100%;
  214. box-sizing: border-box;
  215. padding: 20upx 30upx 0;
  216. }
  217. .feedback-input {
  218. font-size: 32upx;
  219. height: 60upx;
  220. padding: 15upx 20upx;
  221. line-height: 60upx;
  222. }
  223. .feedback-submit {
  224. background: #016bf6;
  225. color: #ffffff;
  226. margin: 20upx;
  227. margin-top: 32upx;
  228. }
  229. </style>