| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482 |
- <!-- -->
- <template>
- <div class="setting_box" :style="'height:' + fullHeight + 'px'">
- <!-- 头部 -->
- <div class="setting_head">
- <div class="setting_head_returnA" @click="FanHui()">
- <img
- src="../../assets/image/new/30.png"
- alt
- class="setting_head_returnA_img"
- />
- </div>
- <!-- 标题 -->
- <div class="head_title">
- <span class="head_title_text">设置</span>
- </div>
- </div>
- <!-- list列表 -->
- <ul class="setting_box_ul">
- <!-- 版本更新 -->
- <li class="setting_box_li" @click="update()">
- <div class="setting_box_li_account">
- <div class="li_account_box">
- <span class="li_account_text">版本更新</span>
- </div>
- </div>
- </li>
- <!-- 版本更新记录 -->
- <li class="setting_box_li" @click="versionsUpdateHistory()">
- <div class="setting_box_li_nickname">
- <div class="li_nickname_box">
- <span class="li_nickname_text">版本更新记录</span>
- </div>
- <div class="nickname_user_box"></div>
- </div>
- </li>
- <!-- 个人信息编辑 -->
- <li class="setting_box_li" @click="userMessage()">
- <div class="setting_box_li_password">
- <div class="li_password_box">
- <span class="li_password_text">个人信息编辑</span>
- </div>
- </div>
- </li>
- <!-- 登录退出 -->
- <li class="setting_box_li" @click="log_out()">
- <div class="setting_box_li_password" style="border: 0">
- <div class="li_password_box">
- <span class="li_password_text">退出登录</span>
- </div>
- </div>
- </li>
- </ul>
- </div>
- </template>
- <script>
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: {},
- data() {
- //这里存放数据
- return {
- fullHeight: document.documentElement.clientHeight,
- isClick: true, //版本更新开关
- };
- },
- //监听属性 类似于data概念
- computed: {},
- //监控data中的数据变化
- watch: {
- fullHeight(val) {
- //监控浏览器高度变化
- if (!this.timer) {
- this.fullHeight = val;
- this.timer = true;
- let that = this;
- setTimeout(function () {
- //防止过度调用监测事件,导致卡顿
- that.timer = false;
- }, 400);
- }
- },
- input: function () {
- this.input = this.input.replace(/[^A-Za-z0-9\u4e00-\u9fa5]/g, "");
- },
- },
- //方法集合
- methods: {
- //动态获取浏览器高度
- get_boderHeight() {
- const that = this;
- window.onresize = () => {
- return (() => {
- window.fullHeight = document.documentElement.clientHeight;
- that.fullHeight = window.fullHeight;
- })();
- };
- },
- //点击返回到home页面
- FanHui() {
- let _this = this;
- _this.$router.replace("/person");
- },
- // 点击进入个人信息编辑界面
- userMessage() {
- var that = this;
- that.$router.push("/mine");
- },
- // 点击进入版本更新记录界面
- versionsUpdateHistory() {
- var that = this;
- that.$router.push("/versions_updateHistory");
- },
- // 点击版本更新请求接口
- update() {
- var that = this;
- var isClick = that.isClick;
- if (isClick === true) {
- that.isClick = false;
- that
- .$axios({
- method: "get",
- url: "http://192.168.1.8:8002/edition",
- })
- .then((res) => {
- console.log(res.data);
- let num = "115"; //当前版本
- var data = res.data.edition_num;
- var a = data.replace(/\./g, "");
- if (num === a) {
- this.$message({
- showClose: true,
- message: "当前已经是最新版本",
- duration: 1500,
- });
- } else if (num < a) {
- this.$notify({
- title: "成功",
- message: "检测到有新版本,需要更新",
- type: "success",
- duration: 1500,
- });
- const timerA = setInterval(() => {
- var wait = plus.nativeUI.showWaiting("下载更新中,请勿关闭");
- //创建一个下载任务
- var dtask = plus.downloader.createDownload(
- "http://192.168.1.8:8002/down_app/deity.apk",
- {
- method: "GET",
- },
- function (d, status) {
- if (status == 200) {
- console.log("Download success: " + d.filename);
- plus.runtime.install(d.filename); // 安装下载的apk文件
- } else {
- that.$message({
- type: "info",
- message: "更新失败",
- });
- // plus.runtime.install('../H5B2852C7_0925104810.apk'); // 安装下载的apk文件
- }
- wait.close();
- }
- );
- //开始下载
- dtask.start();
- clearInterval(timerA);
- }, 1500);
- }
- })
- .catch((err) => {
- console.log(err);
- });
- setTimeout(function () {
- that.isClick = true;
- }, 2000);
- }
- },
- // 点击退出登录
- //退出登录
- log_out() {
- this.$confirm("即将退出登录, 是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.$axios({
- method: "get",
- url: "http://192.168.1.8:8002/out_land",
- })
- .then((res) => {
- if (res.data === 0) {
- this.$message({
- type: "success",
- message: "退出成功!",
- });
- sessionStorage.removeItem("login");
- localStorage.removeItem("homeIndex");
- this.$router.replace("/");
- } else if (res.data === 1) {
- this.$message({
- type: "info",
- message: "退出失败,请重试",
- duration: 1500,
- });
- }
- })
- .catch((err) => {
- this.$message({
- type: "info",
- message: "退出失败,请重试",
- duration: 1500,
- });
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消退出",
- duration: 1500,
- });
- });
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- localStorage.removeItem("insect"); //删除本地的虫害值
- localStorage.removeItem("plant"); //删除本地的病害值
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- let _this = this;
- _this.get_boderHeight();
- },
- };
- </script>
- <style>
- .el-message-box {
- width: 320px;
- }
- </style>
- <style lang='scss' scoped>
- @import "../../assets/scss/bus.scss";
- .setting_box {
- background: #f6f6f6;
- }
- span {
- margin-left: 0;
- }
- // 头部
- .setting_box .setting_head {
- display: flex;
- justify-content: space-between;
- margin-bottom: 0.4rem;
- background: -webkit-linear-gradient(right, #0dc6b6, #0cd3aa, #1dd69c);
- height: 1.2rem;
- }
- // 返回图标
- .setting_box .setting_head_returnA {
- padding: 0.3rem 0 0 0.5rem;
- }
- .setting_head_returnA_img {
- width: 0.5rem;
- height: 0.5rem;
- }
- // 标题
- .setting_box .head_title {
- margin: 0.14rem 3.8rem 0 0;
- }
- .setting_box .head_title_text {
- font-size: 18px;
- font-weight: 500;
- margin: 0 0 0 -2rem;
- line-height: 0.95rem;
- color: #fff;
- }
- // list列表
- .setting_box_ul {
- margin: -0.4rem 0 0 0;
- background: #fff;
- }
- .setting_box_li {
- margin: 0 0 0.2rem 0;
- }
- // 头像
- .setting_box_li_portrait {
- border-bottom: 2px solid #f6f6f6;
- height: 1rem;
- width: 90%;
- margin: 0 auto;
- display: flex;
- justify-content: space-between;
- }
- .li_portrait_box {
- margin: 0.35rem 0 0 0.45rem;
- }
- .li_portrait_text {
- color: #000;
- font-size: 13px;
- font-weight: 500;
- }
- .portrait_img_box {
- margin: 0.1rem 0.15rem 0 0;
- }
- .portrait_img {
- width: 0.8rem;
- height: 0.8rem;
- border-radius: 50px;
- }
- // 账号
- .setting_box_li_account {
- border-bottom: 2px solid #f6f6f6;
- height: 1rem;
- width: 90%;
- margin: 0 auto;
- display: flex;
- justify-content: space-between;
- }
- .li_account_box {
- margin: 0.35rem 0 0 0.45rem;
- }
- .li_account_text {
- // color: #000;
- color: #5c5c5c;
- font-size: 13px;
- font-weight: 500;
- }
- .account_accountNumber_box {
- margin: 0.5rem 0 0 0;
- }
- .accountNumber_text {
- color: #999999;
- }
- // 账号
- .setting_box_li_nickname {
- border-bottom: 5px solid #f6f6f6;
- height: 1rem;
- width: 100%;
- margin: 0 auto;
- display: flex;
- justify-content: space-between;
- }
- .li_nickname_box {
- margin: 0.35rem 0 0 0.95rem;
- }
- .li_nickname_text {
- color: #5c5c5c;
- font-size: 13px;
- font-weight: 500;
- }
- .nickname_user_box {
- margin: 0.5rem 0.55rem 0 0;
- }
- .nickname_text {
- color: #999999;
- }
- //修改密码
- .setting_box_li_password {
- height: 1rem;
- width: 90%;
- margin: 0 auto;
- display: flex;
- justify-content: space-between;
- border-bottom: 2px solid #f6f6f6;
- }
- .li_password_box {
- // margin: .35rem 0 0 .95rem;
- margin: 0.35rem 0 0 0.45rem;
- }
- .li_password_text {
- color: #5c5c5c;
- font-size: 13px;
- font-weight: 500;
- }
- // 修改头像弹框
- .picture_box {
- position: relative;
- top: -6.409rem;
- left: 0;
- background: rgba(0, 0, 0, 0.8);
- }
- .setting_box .modification {
- width: 4rem;
- }
- .picture_box_div {
- border: 1px solid rgb(255, 255, 255);
- position: absolute;
- left: 23%;
- top: 20%;
- border-radius: 5px;
- background: #eeeded;
- }
- .picture_box_ul {
- width: 5.5rem;
- }
- .picture_box_li {
- border-bottom: 1px solid #fff;
- }
- .picture_box_li_text {
- font-size: 23px;
- padding: 0.2rem 0 0.2rem 0;
- color: rgb(146, 146, 146);
- }
- .picture_box_li_del {
- border-bottom: 1px solid #fff;
- }
- .picture_box_del_img {
- width: 0.5rem;
- height: 0.5rem;
- margin: 0 0 0 4.8rem;
- }
- //修改昵称
- .el-button--primary span {
- margin: 0;
- }
- .modify_the_picture {
- display: inline-block;
- }
- .avatar-uploader {
- position: absolute;
- left: 0;
- bottom: 0.5rem;
- }
- .el-icon-plus:before {
- font-size: 40px;
- color: #fff;
- }
- </style>
|