questions.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. <!-- -->
  2. <template>
  3. <div class="questions_box" :style="'height:' + fullHeight + 'px'" v-loading="loading">
  4. <!-- 头部 -->
  5. <div class="questions_head">
  6. <div class="questions_head_returnA" @click="FanHui()">
  7. <img src="../../assets/image/left.png" alt class="questions_head_returnA_img" />
  8. </div>
  9. <!-- 标题 -->
  10. <div class="head_title">
  11. <span class="head_title_text">发布交流</span>
  12. </div>
  13. </div>
  14. <!-- 线 -->
  15. <div class="questions_segment"></div>
  16. <!-- 线 -->
  17. <!-- 步骤 -->
  18. <el-tabs :before-leave="beforeLeave" v-model="activeName" type="card" @tab-click="handleClick">
  19. <!-- 第一步 -->
  20. <el-tab-pane label="1 描述问题" name="first">
  21. <div class="ipt_segmentA"></div>
  22. <!-- 输入作物或昆虫 -->
  23. <div class="radio_box">
  24. <el-radio v-model="radio" label="plant">作物</el-radio>
  25. <el-radio v-model="radio" label="insect">昆虫</el-radio>
  26. </div>
  27. <el-input
  28. maxlength="20"
  29. placeholder="请输入提问作物名或昆虫名(字数限制为20,包括特殊字符)"
  30. v-model="input"
  31. clearable
  32. ></el-input>
  33. <div class="ipt_segmentB"></div>
  34. <!-- 描述问题 -->
  35. <div class="question_box">
  36. <div class="question_text">请描述你的问题</div>
  37. <el-input
  38. maxlength="300"
  39. type="textarea"
  40. :rows="2"
  41. :onkeyup="textarea = textarea.replace(/\s+/g,'')"
  42. placeholder="请详细描述您的问题,以便我们诊断(字数限制为300字,包括特殊字符)"
  43. v-model="textarea"
  44. ></el-input>
  45. </div>
  46. </el-tab-pane>
  47. <!-- 第二步 -->
  48. <el-tab-pane :disabled="this.lianxi == false" label="2 补充照片" name="second">
  49. <div class="img_text">补充病虫害图片</div>
  50. <div class="img_box">
  51. <img src="../../assets/image/jinggao.png" alt class="img_image" />
  52. <span class="img_describe">建议添加最少两张照片以便专家更准确鉴定,等待图片下方出现删除按钮后再点击下一步</span>
  53. <!-- 上传 -->
  54. <div class="uploading_box" v-loading="loadingA">
  55. <el-upload
  56. ref="upload"
  57. :file-list="imgList"
  58. action="/send_answer_img"
  59. list-type="picture-card"
  60. :on-preview="handlePictureCardPreview"
  61. :http-request="handleHttpRequest"
  62. :limit="imgLimit"
  63. :on-remove="clearFiles"
  64. >
  65. <i class="el-icon-plus"></i>
  66. </el-upload>
  67. <el-dialog :visible.sync="dialogVisible">
  68. <img width="100%" :src="dialogImageUrl" alt />
  69. </el-dialog>
  70. </div>
  71. <!-- 删除按钮 -->
  72. <button @click="handleRemove" class="delBtn" v-show="delImage">删除图片</button>
  73. </div>
  74. </el-tab-pane>
  75. <!-- 第三步 -->
  76. <el-tab-pane :disabled="this.lianxiA == false" label="3 补充信息" name="third">
  77. <div class="condition_box">
  78. <div class="condition_text">近期用肥用药情况</div>
  79. <el-input
  80. maxlength="100"
  81. class="condition_ipt"
  82. type="textarea"
  83. :onkeyup="textareaA = textareaA.replace(/\s+/g,'')"
  84. :rows="2"
  85. placeholder="请详细描述,以便诊断(字数限制为100字,包括特殊字符)"
  86. v-model="textareaA"
  87. ></el-input>
  88. </div>
  89. <div class="proportion_box">
  90. <div class="condition_text">发生面积</div>
  91. <ul class="proportion_ul">
  92. <li
  93. class="proportion_li"
  94. @click="getItem(index, item)"
  95. :class="activeClass == index ? 'activeAAAA':''"
  96. v-for="(item, index) in this.proportion"
  97. :key="index"
  98. >{{ item }}</li>
  99. </ul>
  100. </div>
  101. <div class="conditionA_box">
  102. <div class="condition_text">近期天气情况</div>
  103. <ul class="condition_ul">
  104. <li
  105. class="condition_li"
  106. :class="activeClassA == index ? 'activeAAAA':''"
  107. @click="getItemA(index, item)"
  108. v-for="(item,index) in this.conditionA"
  109. :key="index"
  110. >{{ item }}</li>
  111. </ul>
  112. <el-input
  113. maxlength="32"
  114. v-show="iptShow"
  115. class="condition_ipt"
  116. placeholder="请输入具体的天气情况"
  117. v-model="inputA"
  118. clearable
  119. ></el-input>
  120. </div>
  121. </el-tab-pane>
  122. </el-tabs>
  123. <!-- 步骤 -->
  124. <!-- 下一步 -->
  125. <div
  126. class="botNext"
  127. v-bind:class="{ 'nav-hide' : hideClass }"
  128. @click="next()"
  129. v-if="botNext"
  130. >下一步</div>
  131. <div class="botNext" v-bind:class="{ 'nav-hide' : hideClass }" @click="accomplish()" v-else>完成</div>
  132. <!-- 下一步 -->
  133. <!-- 测试地图 -->
  134. <div class="mapbox" v-show="mapShow">
  135. <baidu-map
  136. :style="'height:' + fullHeight + 'px'"
  137. locationIcon
  138. class="map"
  139. :double-click-zoom="true"
  140. @ready="handler"
  141. :center="center"
  142. :zoom="150"
  143. :map-click="false"
  144. :mapStyle="mapStyle"
  145. >
  146. <bm-geolocation
  147. @locationSuccess="getLoctionSuccess"
  148. @locationError="getLoctionError"
  149. anchor="BMAP_ANCHOR_BOTTOM_RIGHT"
  150. :showAddressBar="false"
  151. :autoLocation="true"
  152. ></bm-geolocation>
  153. </baidu-map>
  154. </div>
  155. <!-- 测试地图 -->
  156. </div>
  157. </template>
  158. <script>
  159. import BmMarker from "vue-baidu-map/components/overlays/Marker";
  160. import { BmGeolocation } from "vue-baidu-map";
  161. const markers = [];
  162. const carList = [{}];
  163. export default {
  164. name: "questions",
  165. //限时数据文本的字数限时
  166. filters: {
  167. ellipsis(value) {
  168. if (!value) return "";
  169. if (value.length > 5) {
  170. return value.slice(0, 5) + "...";
  171. }
  172. return value;
  173. }
  174. },
  175. components: {
  176. BmMarker,
  177. // 手动定位控件
  178. BmGeolocation,
  179. // marker控件
  180. BmMarker
  181. },
  182. data() {
  183. return {
  184. isClick: true, //点赞开关
  185. loadingA: false, //加载
  186. loading: true, //加载
  187. imgList: [],
  188. inputA: "", //天气情况
  189. oldActiveName: false,
  190. mapShow: false, //地图
  191. radio: "plant", //作物或昆虫单选框
  192. input: "", //第一步填写提问作物
  193. botNext: true, //下一步按钮
  194. activeName: "first", //步骤
  195. fullHeight: document.documentElement.clientHeight, //一开始的屏幕高度
  196. showHeight: document.documentElement.clientHeight, //按钮被顶上去
  197. hideClass: false, //按钮被顶上去
  198. questionsA: localStorage.getItem("seek_name"),
  199. show2: false, //筛选按钮
  200. reData: [], //后端传来的列表数据
  201. image: "", //后端传来的图片
  202. axiosShow: true, //暂空判断
  203. shows: localStorage.getItem("shows"), //active
  204. textarea: "", //问题描述
  205. //上传图片
  206. dialogImageUrl: "",
  207. dialogVisible: false,
  208. imgLimit: 3, //限制上传图片张数
  209. textareaA: "", //第三步用肥用药情况
  210. iptShow: false, //第三步input框
  211. center: null,
  212. BMap: "",
  213. map: "",
  214. markers,
  215. carList,
  216. show: false,
  217. redata: [], //后端传来的数据
  218. active: false,
  219. latA: "",
  220. lngA: "",
  221. nameShow: false,
  222. mapStyle: {
  223. styleJson: [
  224. {
  225. featureType: "all",
  226. elementType: "geometry",
  227. stylers: {
  228. // hue: "#007fff",
  229. hue: "#eb8f16",
  230. saturation: 89
  231. }
  232. },
  233. {
  234. featureType: "water",
  235. elementType: "all",
  236. stylers: {
  237. color: "#ffffff"
  238. }
  239. }
  240. ]
  241. },
  242. //设置地图详细信息
  243. address: "", //位置详细信息
  244. jgNameDialog: false,
  245. show: false,
  246. postionMap: {
  247. //地图坐标
  248. lng: 120.211486,
  249. lat: 30.256576
  250. },
  251. location: "",
  252. keyword: "", //搜索框关键词
  253. // zoom: 12.8, //放大比例
  254. address: "", //位置详细信息
  255. add: {
  256. siteName: "",
  257. site: "",
  258. jd: "",
  259. wd: "",
  260. desce: "",
  261. type: "",
  262. jgName: "",
  263. jgNum: ""
  264. },
  265. organizationData: [],
  266. jgName: "",
  267. jgNum: "",
  268. weatherdata: [],
  269. activeClass: -1, // 0为默认选择第一个,-1为不选择
  270. activeClassA: -1,
  271. proportion: ["一两株", "小范围", "成片或整田"],
  272. conditionA: [
  273. "无异常",
  274. "高温",
  275. "低温",
  276. "高湿",
  277. "干旱",
  278. "连续雨",
  279. "霜冻",
  280. "台风",
  281. "其他"
  282. ],
  283. addImage: [], //图片
  284. delImage: false, //删除按钮
  285. //测试返回的布尔值
  286. lianxi: true,
  287. lianxiA: false
  288. };
  289. },
  290. //监听属性 类似于data概念
  291. computed: {},
  292. //监控data中的数据变化
  293. watch: {
  294. fullHeight(val) {
  295. //监控浏览器高度变化
  296. if (!this.timer) {
  297. this.fullHeight = val;
  298. this.timer = true;
  299. let that = this;
  300. setTimeout(function() {
  301. //防止过度调用监测事件,导致卡顿
  302. that.timer = false;
  303. }, 400);
  304. }
  305. },
  306. activeName(val) {
  307. if (this.activeName === "first") {
  308. if (this.input !== "" && this.textarea !== "") {
  309. this.activeName = "second";
  310. this.lianxi = true;
  311. } else if (this.input === "") {
  312. this.$notify({
  313. title: "警告",
  314. message: "作物或昆虫名称不能为空",
  315. type: "warning",
  316. duration: 1500
  317. });
  318. this.lianxi = false;
  319. } else if (this.textarea === "") {
  320. this.$notify({
  321. title: "警告",
  322. message: "作物或昆虫描述不能为空",
  323. type: "warning",
  324. duration: 1500
  325. });
  326. this.lianxi = false;
  327. }
  328. } else if (this.activeName === "second") {
  329. // if (localStorage.getItem("add") !== null) {
  330. // this.activeName = "third";
  331. // this.lianxi = true;
  332. // } else if (localStorage.getItem("add") === null) {
  333. // this.$notify({
  334. // title: "警告",
  335. // message: "请先上传图片,再进行下一步",
  336. // type: "warning",
  337. // duration: 1500
  338. // });
  339. // this.lianxi = false;
  340. // }
  341. } else if (this.activeName === "third") {
  342. if (localStorage.getItem("add") !== null) {
  343. this.activeName = "third";
  344. this.lianxi = true;
  345. this.botNext = false;
  346. } else if (localStorage.getItem("add") === null) {
  347. this.$notify({
  348. title: "警告",
  349. message: "请先上传图片,再进行下一步",
  350. type: "warning",
  351. duration: 1500
  352. });
  353. this.lianxi = false;
  354. }
  355. }
  356. },
  357. radio(val) {},
  358. addImage(val) {
  359. if (val !== null) {
  360. this.delImage = true;
  361. this.loadingA = false;
  362. } else {
  363. this.delImage = false;
  364. this.loadingA = false;
  365. }
  366. },
  367. botNext(val) {
  368. console.log(val);
  369. },
  370. //输入作物昆虫名
  371. input: function() {
  372. this.input = this.input.replace(/[^A-Za-z0-9\u4e00-\u9fa5]/g, "");
  373. },
  374. //天气具体情况
  375. inputA: function() {
  376. this.inputA = this.inputA.textarea(/[^A-Za-z0-9\u4e00-\u9fa5]/g, "");
  377. },
  378. //按钮被顶上去
  379. showHeight: "inputType"
  380. },
  381. //方法集合
  382. methods: {
  383. //动态获取浏览器高度
  384. get_boderHeight() {
  385. const that = this;
  386. window.onresize = () => {
  387. return (() => {
  388. window.fullHeight = document.documentElement.clientHeight;
  389. that.fullHeight = window.fullHeight;
  390. })();
  391. };
  392. },
  393. // 返回home页面
  394. FanHui() {
  395. let _this = this;
  396. // localStorage.removeItem("memoryBiaoshi");
  397. // localStorage.removeItem("questionsPage");
  398. // localStorage.removeItem("shows");
  399. localStorage.removeItem("add");
  400. // _this.$router.push("/home");
  401. _this.$router.replace("/home");
  402. },
  403. //百度地图事件
  404. //地图初始化
  405. handler({ BMap, map }) {
  406. const _this = this;
  407. // 获取自动定位方法
  408. var geolocation = new BMap.Geolocation();
  409. // 获取逆解析方法实例
  410. this.myGeo = new BMap.Geocoder();
  411. // 获取自动定位获取的坐标信息
  412. geolocation.getCurrentPosition(
  413. function(r) {
  414. _this.center = {
  415. lng: r.point.lng,
  416. lat: r.point.lat
  417. };
  418. _this.point = {
  419. lng: r.point.lng,
  420. lat: r.point.lat
  421. };
  422. localStorage.setItem("jingdu", _this.point.lng); //存经纬度
  423. localStorage.setItem("weidu", _this.point.lat);
  424. _this.ceshi(r);
  425. },
  426. { enableHighAccuracy: true }
  427. );
  428. map.enableScrollWheelZoom(true);
  429. _this.BMap = BMap;
  430. _this.map = map;
  431. },
  432. //手动定位成功回调
  433. getLoctionSuccess(e) {
  434. this.lngA = e.point.lng;
  435. this.latA = e.point.lat;
  436. localStorage.setItem("jingdu", this.lngA); //存经纬度
  437. localStorage.setItem("weidu", this.latA);
  438. this.show = true;
  439. this.postionMap.lng = e.point.lng; //通过 e.point.lng获取经度
  440. this.postionMap.lat = e.point.lat; //通过 e.point.lat获取纬度
  441. this.add.jd = e.point.lng;
  442. this.add.wd = e.point.lat;
  443. let geocoder = new BMap.Geocoder(); //创建地址解析器的实例
  444. geocoder.getLocation(e.point, rs => {
  445. this.add.site = rs.address;
  446. //地址描述(string)=
  447. // console.log(rs.address); //这里打印可以看到里面的详细地址信息,可以根据需求选择想要的
  448. // console.log(rs.addressComponents);//结构化的地址描述(object)
  449. // console.log(rs.addressComponents.province); //省
  450. // console.log(rs.addressComponents.city); //城市
  451. // console.log(rs.addressComponents.district); //区县
  452. // console.log(rs.addressComponents.street); //街道
  453. // console.log(rs.addressComponents.streetNumber); //门牌号
  454. // console.log(rs.surroundingPois); //附近的POI点(array)
  455. // console.log(rs.business); //商圈字段,代表此点所属的商圈(string)
  456. let a = rs.addressComponents.province;
  457. let b = rs.addressComponents.city;
  458. let c = rs.addressComponents.district;
  459. let d = rs.addressComponents.street;
  460. let e = rs.addressComponents.streetNumber;
  461. localStorage.setItem("dizhi", a + b + c + d + e); //存地址
  462. });
  463. this.loadinAShow = false; //关闭地图加载动画
  464. },
  465. //手动定位失败回调
  466. getLoctionError() {
  467. alert("定位失败");
  468. },
  469. //自动定位
  470. ceshi(r) {
  471. let geocoder = new BMap.Geocoder(); //创建地址解析器的实例
  472. geocoder.getLocation(r.point, rs => {
  473. this.add.site = rs.address;
  474. let a = rs.addressComponents.province;
  475. let b = rs.addressComponents.city;
  476. let c = rs.addressComponents.district;
  477. let d = rs.addressComponents.street;
  478. let e = rs.addressComponents.streetNumber;
  479. localStorage.setItem("dizhi", a + b + c + d + e); //存地址
  480. });
  481. this.loadinAShow = false; //关闭地图加载动画
  482. this.loading = false;
  483. },
  484. //交流,个人秀
  485. handleClick(e) {},
  486. //步骤
  487. handleClick(tab, event) {},
  488. clearFiles() {},
  489. //上传图片
  490. handleRemove() {
  491. let postData = this.$qs.parse({
  492. pic_list: localStorage.getItem("add"),
  493. ret: this.radio,
  494. req: "prob"
  495. });
  496. return this.$confirm("确定要删除图片吗", "提示", {
  497. confirmButtonText: "确定",
  498. cancelButtonText: "取消",
  499. type: "warning"
  500. })
  501. .then(() => {
  502. this.$axios({
  503. method: "post",
  504. url: "bigservers/del_img",
  505. data: postData
  506. })
  507. .then(res => {
  508. if (res.data === 0) {
  509. this.$notify({
  510. title: "成功",
  511. message: "删除成功",
  512. type: "success",
  513. duration: 1500
  514. });
  515. this.$refs.upload.clearFiles();
  516. localStorage.removeItem("add");
  517. } else if (res.data === 1) {
  518. this.$notify.error({
  519. title: "错误",
  520. message: "删除失败",
  521. duration: 1500
  522. });
  523. }
  524. })
  525. .catch(error => {
  526. console.log(error);
  527. });
  528. })
  529. .catch(() => {
  530. throw new Error("取消成功!");
  531. });
  532. },
  533. handlePictureCardPreview(file) {
  534. this.dialogImageUrl = file.url;
  535. this.dialogVisible = true;
  536. },
  537. handleHttpRequest(file) {
  538. let _this = this;
  539. _this.loadingA = true;
  540. let form = new FormData();
  541. form.append("file", file.file);
  542. form.append("ret", this.radio);
  543. form.append("req", "prob");
  544. _this
  545. .$axios({
  546. method: "post",
  547. url: "bigservers/send_answer_img",
  548. anync: true,
  549. data: form,
  550. headers: {
  551. "Content-Type": "multipart/form-data"
  552. }
  553. })
  554. .then(res => {
  555. _this.addImage.push(res.data.src);
  556. _this.btnShow = true;
  557. this.lianxi = true;
  558. _this.loadingA = false;
  559. localStorage.setItem("add", _this.addImage);
  560. })
  561. .catch(error => {});
  562. },
  563. //点击选中其他显示input
  564. elseIpt() {
  565. this.iptShow = true;
  566. },
  567. //点击下一步
  568. next() {
  569. if (this.activeName === "first") {
  570. if (this.input !== "" && this.textarea !== "") {
  571. this.activeName = "second";
  572. this.lianxi = true;
  573. } else if (this.input === "") {
  574. this.$notify({
  575. title: "警告",
  576. message: "作物或昆虫名称不能为空",
  577. type: "warning",
  578. duration: 1500
  579. });
  580. this.lianxi = false;
  581. } else if (this.textarea === "") {
  582. this.$notify({
  583. title: "警告",
  584. message: "作物或昆虫描述不能为空",
  585. type: "warning",
  586. duration: 1500
  587. });
  588. this.lianxi = false;
  589. }
  590. } else if (this.activeName === "second") {
  591. if (localStorage.getItem("add") !== null) {
  592. this.activeName = "third";
  593. this.lianxi = true;
  594. this.lianxiA = true;
  595. } else if (localStorage.getItem("add") === null) {
  596. this.$notify({
  597. title: "警告",
  598. message: "请先上传图片,再进行下一步",
  599. type: "warning",
  600. duration: 1500
  601. });
  602. this.lianxiA = false;
  603. this.lianxi = true;
  604. }
  605. }
  606. },
  607. beforeLeave(item) {},
  608. //新建完成
  609. accomplish() {
  610. let _this = this;
  611. if (localStorage.getItem("tianqi") === "其他") {
  612. var a = this.inputA;
  613. } else {
  614. var a = localStorage.getItem("tianqi");
  615. }
  616. var isClick = _this.isClick;
  617. if (isClick === true) {
  618. _this.isClick = false;
  619. //判断是否填写完整
  620. if (
  621. _this.textareaA !== "" &&
  622. localStorage.getItem("area") !== null &&
  623. (a !== null || a !== "")
  624. ) {
  625. let postData = _this.$qs.parse({
  626. name: this.input, //病虫害名字
  627. problem: this.textarea, //描述信息
  628. addr: localStorage.getItem("dizhi"), //地址
  629. ret: this.radio, //病虫害类型
  630. img_list: localStorage.getItem("add"), //图片
  631. drug: this.textareaA, //肥料和用药情况
  632. area: localStorage.getItem("area"), //面积
  633. weather: a, //天气
  634. lat: localStorage.getItem("jingdu"), //经度
  635. lng: localStorage.getItem("weidu") //纬度
  636. });
  637. _this
  638. .$axios({
  639. method: "post",
  640. url: "bigservers/save_answer",
  641. data: postData
  642. })
  643. .then(res => {
  644. if (res.data === 0) {
  645. this.$notify({
  646. title: "成功",
  647. message: "新建交流成功",
  648. type: "success",
  649. duration: 1500
  650. });
  651. this.delData();
  652. _this.$router.push("/home");
  653. const timer = setInterval(() => {
  654. location.reload();
  655. }, 1000);
  656. } else if (res.data === 1) {
  657. this.$notify.error({
  658. title: "错误",
  659. message: "新建交流失败,请重试",
  660. duration: 1500
  661. });
  662. }
  663. })
  664. .catch(error => {
  665. this.$notify.error({
  666. title: "错误",
  667. message: "新建交流失败,请重试",
  668. duration: 1500
  669. });
  670. });
  671. } else {
  672. this.$notify({
  673. title: "警告",
  674. message: "请将信息填写完整",
  675. type: "warning",
  676. duration: 1500
  677. });
  678. }
  679. setTimeout(function() {
  680. _this.isClick = true;
  681. }, 2500);
  682. }
  683. },
  684. //切换active-面积
  685. getItem(index, item) {
  686. this.activeClass = index;
  687. localStorage.setItem("area", item);
  688. },
  689. //切换active-天气
  690. getItemA(index, item) {
  691. this.activeClassA = index;
  692. localStorage.setItem("tianqi", item);
  693. if (item === "其他") {
  694. this.elseIpt();
  695. } else {
  696. this.iptShow = false;
  697. }
  698. },
  699. //新建成功删除本地数据
  700. delData() {
  701. localStorage.removeItem("tianqi"); //天气其他
  702. localStorage.removeItem("area"); //面积
  703. localStorage.removeItem("dizhi"); //地址
  704. localStorage.removeItem("weidu"); //纬度
  705. localStorage.removeItem("jingdu"); //经度
  706. localStorage.removeItem("add"); //图片
  707. this.$router.replace("/home");
  708. },
  709. //按钮被顶上去
  710. inputType() {
  711. if (!this.timer) {
  712. this.timer = true;
  713. let that = this;
  714. setTimeout(() => {
  715. if (that.fullHeight > that.showHeight) {
  716. //显示class
  717. this.hideClass = true;
  718. } else if (that.fullHeight <= that.showHeight) {
  719. //显示隐藏
  720. this.hideClass = false;
  721. }
  722. that.timer = false;
  723. }, 20);
  724. }
  725. }
  726. },
  727. //生命周期 - 创建完成(可以访问当前this实例)
  728. created() {
  729. //将tab切换设置为不可操作
  730. this.lianxi = false;
  731. },
  732. //生命周期 - 挂载完成(可以访问DOM元素)
  733. mounted() {
  734. var _this = this
  735. _this.get_boderHeight();
  736. setTimeout(function() {
  737. _this.loading = false;
  738. }, 1500);
  739. // window.onresize监听页面高度的变化
  740. window.onresize = () => {
  741. return (() => {
  742. window.screenHeight = document.body.clientHeight;
  743. this.showHeight = window.screenHeight;
  744. })();
  745. };
  746. }
  747. };
  748. </script>
  749. <style lang='scss'>
  750. @import "../../assets/scss/bus.scss";
  751. @import "../../assets/scss/questions.scss";
  752. </style>