Przeglądaj źródła

提交代码好牛逼

xia 4 lat temu
rodzic
commit
76e351dd12

+ 2 - 2
package.json

@@ -2,7 +2,7 @@
   "name": "zsy_quick_app",
   "version": "1.0.0",
   "subversion": {
-    "toolkit": "0.6.6"
+    "toolkit": "0.7.1"
   },
   "description": "",
   "scripts": {
@@ -18,7 +18,7 @@
     "eslint-plugin-hybrid": "0.0.5",
     "less": "^3.10.3",
     "less-loader": "^5.0.0",
-    "hap-toolkit": "^0.6.6"
+    "hap-toolkit": "^0.7.1"
   },
   "dependencies": {
     "flyio": "^0.6.14"

+ 8 - 2
src/api/fly.js

@@ -9,11 +9,13 @@ import fetch from "@system.fetch";
 import Fly from "flyio/dist/npm/hap";
 import apiConfig from "./config";
 import prompt from '@system.prompt';
+import storage from "@system.storage";
 import { getToken, clearToken, getSendOrderId } from "./utils";
 import it from "../helper/interface.js";
 var fly = new Fly(fetch);
 var qs = require('qs');
 var appInfo = it.getAppInfo();
+var provider = it.getProvider();
 var appDev, sendOrderId;
 var packages = 'com.beidao.kuaiying.zsy';
 var requestTime = '';
@@ -21,6 +23,7 @@ var requestTime = '';
 it.getAppDev((res) => {
   appDev = res;
 })
+
 getSendOrderId((id) => {
   sendOrderId = id;
 })
@@ -47,14 +50,17 @@ const isSameRequest = async (url) =>{
 }
 
 fly.interceptors.request.use(async config => {
-  // 过滤一些不需要登录的路由d
+  // 过滤一些不需要登录的路由
   if (filterNoToken.indexOf(config.url) === -1) {
     let token = await getToken();
+    let regId = (await storage.get({ key: "regId" })).data;
     if (config.headers) {
       config.headers.Authorization = token;
       config.headers["X-Version"] = appInfo.versionName;
       config.headers["X-Brand"] = qs.stringify(appDev);
       config.headers["X-Package"] = packages;
+      config.headers["X-regId"] = regId;
+      config.headers["X-Provider"] = provider;
       if (sendOrderId) config.headers["send-order-id"] = sendOrderId;
     }
     else {
@@ -89,7 +95,7 @@ fly.interceptors.request.use(async config => {
 fly.interceptors.response.use(
   async res => {
     if (!res.data.code) {
-      return res.data.data;
+      return Promise.resolve(res.data.data);
     } else if (res.data.code === 10023 || res.data.code === 10001) {
       // token失效
       await clearToken();

+ 35 - 0
src/api/index.js

@@ -162,4 +162,39 @@ export const urgeUpdate = params => {
 //更新派单ID
 export const setSendOrderId = id => {
   return fly.get("/user/setSendOrder", { id: id });
+};
+
+//用户加桌
+export const userAddDsktop = statu => {
+  return fly.get("/user/addDesktop", { status: statu });
+};
+
+//用户任务列表
+export const userTaskList = () => {
+  return fly.get("/user/task");
+};
+
+//完成任务
+export const getTaskAward = (id) => {
+  return fly.get(`/user/task/get/${id}`);
+};
+
+//获取签到信息
+export const getSignInfo = () => {
+  return fly.get('/sign/info');
+};
+
+//非VIP用户签到
+export const noVipSign = () => {
+  return fly.get('/sign/new');
+};
+
+//任务页面书籍位置
+export const taskBook = () => {
+  return fly.get('/books/recommen');
+}
+
+//获取全局变量
+export const userOptions = () => {
+  return fly.get("/options");
 };

+ 5 - 6
src/api/utils.js

@@ -43,17 +43,16 @@ export const login = async () => {
   const signKey = "a!A&AFRWT65Nb3NlklezUiqHyQAA@Z8M";
   const packages = 'com.beidao.kuaiying.zsy';
   let device_info = (await device.getInfo()).data;
-  let {user:androidid,mac:mac,device:device_no} = (await device.getId({type:['device', 'mac','user']})).data;
+  let androidid = (await device.getUserId()).data;
   let send_order_id = (await storage.get({ key: "send_order_id" })).data;
   let timestamp = parseInt(new Date().valueOf() / 1000);
   let queryString = "";
-  if (send_order_id) queryString = `androidid=${androidid}&device_info=${JSON.stringify(device_info)}&device_no=${device_no}&mac=${mac}&package=${packages}&send_order_id=${send_order_id}&timestamp=${timestamp}&key=${signKey}`;
-  else queryString = `androidid=${androidid}&device_info=${JSON.stringify(device_info)}&device_no=${device_no}&mac=${mac}&package=${packages}&timestamp=${timestamp}&key=${signKey}`;
+  if (send_order_id) queryString = `androidid=${androidid.userId}&device_info=${JSON.stringify(device_info)}&device_no=${androidid.userId}&package=${packages}&send_order_id=${send_order_id}&timestamp=${timestamp}&key=${signKey}`;
+  else queryString = `androidid=${androidid.userId}&device_info=${JSON.stringify(device_info)}&device_no=${androidid.userId}&package=${packages}&timestamp=${timestamp}&key=${signKey}`;
   let data = qs.stringify({
-    androidid:androidid,
+    androidid:androidid.userId,
     device_info: JSON.stringify(device_info),
-    device_no: device_no,
-    mac:mac,
+    device_no: androidid.userId,
     package: packages,
     send_order_id: send_order_id,
     timestamp: timestamp,

+ 15 - 8
src/app.ux

@@ -11,10 +11,13 @@
  */
 import "./helper/regenerator.js";
 import it from "./helper/interface.js";
+import storage from "@system.storage";
+
 export default {
   async onCreate() {
     this.dataCache = {
     }
+
     // 一进入程序就判断是否添加过主屏幕
     it.shortcut.systemPromptEnabled = false;
     await it.shortcut.hasInstalled({
@@ -24,13 +27,17 @@ export default {
         else this.$def.data.backClickCount = 1;
       }
     })
-    
+
+     it.getPushRedId(regId=>{
+       storage.set({ key: "regId", value: regId });
+    })
+
   },
-  getAppData (key) {
-      return this.dataCache[key]
+  getAppData(key) {
+    return this.dataCache[key]
   },
-  setAppData (key, val) {
-      this.dataCache[key] = val
+  setAppData(key, val) {
+    this.dataCache[key] = val
   },
   showMenu: it.showMenu,
   getDeviceInfo: it.getDeviceInfo,
@@ -39,9 +46,9 @@ export default {
     backClickCount: 0,
     cutomerQrcode: "",
     weChat: "wxlxf1099",
-    appVersion:'',
-    dataCache : {
-      backfrom:''
+    appVersion: '',
+    dataCache: {
+      backfrom: ''
     }
   }
 };

BIN
src/assets/imgs/black_back.png


BIN
src/assets/imgs/question.png


BIN
src/assets/imgs/rukou.png


BIN
src/assets/imgs/task.png


BIN
src/assets/imgs/task_gift.png


BIN
src/assets/imgs/white_back.png


+ 3 - 1
src/assets/less/my.less

@@ -46,7 +46,9 @@
 
       .item-name {
         flex: 1;
-
+        .orange{
+          color: #CD8119;
+        }
         image {
           width: 40px;
           margin-right: 40px;

+ 3 - 0
src/assets/less/phone.less

@@ -19,11 +19,14 @@
       font-size: 28px;
       border:0;
       width: 300px;
+      height:90px;
     }
     .send-msg{
       font-size:24px;
       color:#EF5952;
       margin-right:20px;
+      height:90px;
+      line-height:90px;
     }
     .disabled{
       color:#ccc;

+ 60 - 8
src/assets/less/reader.less

@@ -14,7 +14,7 @@
       font-weight: bolder;
       color: #1a1a1a;
       font-size: 38px;
-      padding: 150px 0;
+      padding: 80px 0 60px;
     }
 
     .add-shelf {
@@ -30,17 +30,21 @@
   .reader-content {
     margin: 0 24px;
     flex-direction: column;
-     .bottom-setting{
+      .readContent{
+        width:100%;
+        flex-direction: column;
+      }
+     .bottom-setting{ 
        height:332px;
        position: fixed;
-       bottom: 0;
+       bottom: 0; 
        width: 100%;
        padding:40px 30px;
        flex-direction: column;
        justify-content:flex-start;
        left:0;
        .item-page{
-         margin-top:40px;
+         padding-top:40px;
          justify-content: space-between;
        }
        .item-color{
@@ -130,9 +134,57 @@
   top:0;
   left:0;
   width:100%;
-  height:60px;
-  line-height: 60px;
-  padding-left:28px;
+  height:120px;
+  line-height: 120px;
   color:#999;
-  font-size:24px;
+  font-size:30px;
+  padding: 0 30px;
+  justify-content: space-between;
+  align-items: center;
+  .back-icon{
+    width:30px;
+    height:30px;
+  }
+}
+.mustToask{
+  position: fixed;
+	top: 0;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	background-color: rgba(0, 0, 0, 0.56);
+	flex-direction: column;
+	align-items: center;
+	justify-content: center;
+  z-index: 2;
+  .mustBox{
+    background-color: #fff;
+    width:600px;
+    height:400px;
+    flex-direction: column;
+    border-radius: 15px;
+    text-align: center;
+    justify-content: center;
+    align-items: center;
+    .title-must{
+      text-align: center;
+      font-size:40px;
+      padding-top: 50px;
+      font-weight: bold;
+    }
+    .content{
+      text-align: center;
+      margin:60px 0;
+      color:#666;
+    }
+    .button-must{
+      text-align: center;
+      color:#fff;
+      margin:0 auto;
+      width:250px;
+      height:80px;
+      background-color:#fd555d;
+      border-radius: 20px;
+    }
+  }
 }

+ 234 - 0
src/assets/less/task.less

@@ -0,0 +1,234 @@
+.task-page{
+    flex-direction: column;
+    background-color: #F7F7F7;
+    .task-banner{
+			width:100%;
+			height:300px;
+			.swipe-item{
+				height:300px;
+				width:100%;
+			}
+    }
+    .sign-section{
+			width: 690px;
+			height: 466px;
+			border-radius:12px;
+			background-color: #fff;
+			box-shadow:0px 0px 9px 0px rgba(0,0,0,0.05);
+			margin: -30px auto;
+			padding: 38px 18px;
+			justify-content: flex-start;
+			align-items: flex-start;
+			flex-direction: column;
+			line-height: 150%;
+			.sign-title{
+				align-items: center;
+				text{
+					font-size: 28px;
+					font-weight: 800;
+				}
+				image{
+					width:22px;
+					height:22px;
+					margin-left:5px;
+				}
+			}
+			.sign-desc{
+				font-size:24px;
+				color:#999;
+				margin-top:10px;
+			}
+    }
+}
+.sign{
+	&-line {
+    margin:50px auto 20px;
+		height: 140px;
+		width: 100%;
+    &__item {
+      flex: 1;
+      flex-direction: column;
+      align-items: center;
+      justify-content: space-around;
+    }
+    &__day {
+      color: #999;
+      font-size: 22px;
+    }
+    image {
+      width: 40px;
+      height: 40px;
+    }
+    &__fee {
+      font-size: 22px;
+		}
+	}
+	&-button{
+		width:424px;
+		height:72px;
+		line-height: 72px;
+		background-color:#EF5952;
+		border-radius: 36px;
+		font-size:34px;
+		margin: 15px auto 0;
+		color:#fff;
+		text-align: center;
+	}
+	&-button-disabled{
+		width:424px;
+		height:72px;
+		line-height: 72px;
+		background-color:#FCDEDC;
+		border-radius: 36px;
+		font-size:34px;
+		margin: 15px auto 0;
+		color:#EF5952;
+		text-align: center;
+	}
+}
+
+.task{
+	&-section{
+		flex-direction: column;
+		padding:34px 30px;
+		width:690px;
+		box-shadow:0px 0px 18px 0px rgba(0,0,0,0.06);
+		border-radius: 12px;
+		margin: 50px auto 0;
+		background-color: #fff;
+		.banner{
+			width:630px;
+			height:120px;
+			margin-top:20px;
+		}
+		&__tab{
+			justify-content: space-around;
+			text{
+				font-size:32px;
+				padding: 10px 0;
+				border-bottom: 4px solid transparent;
+			}
+			.on{
+				color: #EF5952;
+				border-bottom:4px solid #EF5952;
+				font-weight: bold;
+			}
+		}
+		&__list{
+			flex-direction: column;
+			.list-item{
+				margin:24px 0;
+				height:76px;
+				align-items: center;
+				.icon{
+					width:54px;
+					height:54px;
+				}
+				.content{
+					flex-direction: column;
+					flex:1;
+					margin-left:10px;
+					.content-desc{
+						color: #999;
+						margin-top:5px;
+						font-size:22px;
+					}
+				}
+				.task-award{
+					align-items: flex-end;
+					padding-left:20px;
+					image{
+						width:26px;
+						height:26px;
+					}
+					text{
+						color: #999;
+						font-size:22px;
+					}
+				}
+				.button-status{
+					width:108px;
+					height:40px;
+					border-radius:20px;
+					text-align: center;
+					font-size: 22px;
+				}
+				.wait{
+					border:1px solid #EF5952;
+					background-color: #fff;
+					color:#EF5952;
+				}
+				.disabled{
+					background-color:#eee;
+					color:#999
+				}
+				.get{
+					background-color: #EF5952;
+					color:#fff;
+				}
+			}
+		}
+	}
+}
+.mask{
+	position: fixed;
+	top: 0;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	background-color: rgba(0, 0, 0, 0.56);
+	flex-direction: column;
+	align-items: center;
+	justify-content: center;
+	z-index: 2;
+	.rule{
+		width:600px;
+		height:384px;
+		padding: 34px 30px;
+		border-radius: 12px;
+		background-color:#fff;
+		margin:-100px auto 0;
+		align-items: flex-start;
+		justify-content: flex-start;
+		flex-direction: column;
+		.rule-title{
+			width: 100%;
+			text-align: center;
+			font-size: 32px;
+			color: #333;
+			margin-bottom: 40px;
+		}
+		.detail{
+			color:#999;
+			margin-top:30px;
+			font-size: 26px;
+		}
+	}
+	.close-icon{
+		width: 60px;
+		height: 60px;
+		margin-top:40px;
+	}
+}
+.sign{
+	&-banner {
+    background-image: url(../../assets/imgs/sign_bg.jpg);
+    background-size: cover;
+    background-repeat: no-repeat;
+    justify-content: center;
+    width: 600px;
+    height: 322px;
+    border-radius: 30px;
+    &__text {
+      font-size: 34px;
+      color: #fff;
+      font-weight: bold;
+      margin-top: 200px;
+      .orange {
+        color: #ffc017;
+        font-size: 46px;
+        padding: 0 6px;
+      }
+    }
+  }
+}

+ 42 - 14
src/components/short/index.ux

@@ -1,14 +1,15 @@
 <template>
 	<div class="short-wrap">
 		<div class="short-content" @click="createShortcut">
-			<text class="short-text">保存到手机方便下次阅读>></text>
+			<text class="short-left" >点击保存到桌面,方便继续阅读</text>
+			<text class="short-right">免费领100书币</text>
 		</div>
 	</div>
 </template>
 <script>
 import shortcut from '@system.shortcut';
 import prompt from '@system.prompt';
-
+import {userAddDsktop} from '../../api/index.js';
 export default {
 	data: {
 
@@ -24,8 +25,16 @@ export default {
 					shortcut.install({
 						message: "添加【追书云】到桌面,方便下次阅读",
 						success: () => {
-							prompt.showToast("添加成功!");
 							this.$emit("addshort", { installed: true });
+							 if (this.$app.$def.data.backClickCount === 0) {
+								this.$app.$def.data.backClickCount++;
+								return true;
+							 }
+							userAddDsktop(1).then(res=>{
+							//TODO 加桌后统计上报
+							}).catch(r=>{
+							//TODO 失败后统计上报
+							});	
 						},
 						fail: (code) => {
 							console.log(code);
@@ -44,23 +53,42 @@ export default {
 .short {
   &-wrap {
     position: fixed;
-    bottom: 140px;
+    bottom: 200px;
     height: 80px;
-    justify-content: center;
-    width: 100%;
+		justify-content: center;
+		width: 100%;
+		opacity:0.95;
   }
   &-content {
-    background-color: #ef5952;
-    border-radius: 40px;
-    width: 600px;
+    width: 650px;
     align-items: center;
-    justify-content: center;
+		justify-content: center;
+		opacity: 0.95;
+		border-radius: 40px;
+		height:80px;
   }
-  &-text {
+  &-left {
     color: #fff;
-    font-size: 30px;
+    font-size: 28px;
     font-weight: bold;
-    text-align: center;
-  }
+		text-align: center;
+		background-color:#FF453C;
+		width:444px;
+		height:80px;
+		border-top-left-radius: 40px;
+		border-bottom-left-radius: 40px;
+		opacity:0.95;
+	}
+	&-right{
+		text-align: center;
+		font-weight: bold;
+		 font-size: 28px;
+		background-color:#FFB540;
+		width:206px;
+		height:80px;
+		border-top-right-radius: 40px;
+		border-bottom-right-radius: 40px;
+		opacity:0.95;
+	}
 }
 </style>

+ 74 - 2
src/helper/interface.js

@@ -3,6 +3,7 @@ import device from "@system.device";
 import prompt from "@system.prompt";
 import shortcut from "@system.shortcut";
 import router from "@system.router";
+import push from '@service.push';
 
 const SHORT_CUT_FORBIDDEN_INFO = "User forbidden";
 
@@ -14,11 +15,28 @@ const getDeviceInfo = () => {
     }
   });
 };
+
+//获取订阅推送
+const getPushRedId = fn => {
+  push.subscribe({
+    success: ret => {
+      fn && fn(ret.regId);
+    }
+  });
+};
+
 //获取应用信息
 const getAppInfo = () => {
   const appInfo = app.getInfo();
   return appInfo;
 };
+
+//获取provider
+const getProvider = () => {
+  const provider = push.getProvider();
+  return provider;
+};
+
 //获取设备明细
 const getAppDev = fn => {
   device.getInfo({
@@ -53,20 +71,70 @@ const hasCreateShortCut = (isPayPage = false, fn) => {
             fn && fn(true);
           },
           fail: code => {
+            fn && fn(false);
             if (code === SHORT_CUT_FORBIDDEN_INFO && !isPayPage) app.exit();
           }
         });
+      } else {
+        fn && fn(false);
       }
     }
   });
 };
 
+//强制加桌
+const mustCreateShort = (fn) => {
+  shortcut.hasInstalled({
+    success: ret => {
+      if (!ret) {
+        shortcut.install({
+          message: "添加【追书云】到桌面,方便下次阅读",
+          success: () => {
+            prompt.showToast("添加成功!");
+            fn && fn(true);
+          },
+          fail: code => {
+            prompt.showToast("取消操作");
+          }
+        });
+      } else {
+        fn && fn(false);
+      }
+    }
+  });
+
+}
+
+//用于返回时提醒加桌
+const backCreateShortCut = (fn) => {
+  shortcut.hasInstalled({
+    success: ret => {
+      if (!ret) {
+        shortcut.install({
+          message: "添加【追书云】到桌面,方便下次阅读",
+          success: () => {
+            prompt.showToast("添加成功!");
+            fn && fn('back')
+          },
+          fail: code => {
+            console.log('我失败了我失败了')
+            fn && fn('back')
+          }
+        });
+      } else {
+        fn && fn('back')
+      }
+    }
+  });
+};
+
+
 // 右上角菜单点击
 const showMenu = () => {
   const appInfo = app.getInfo();
   prompt.showContextMenu({
     itemList: ["保存桌面", "关于", "取消"],
-    success: function(ret) {
+    success: function (ret) {
       switch (ret.index) {
         case 0:
           // 保存桌面
@@ -98,9 +166,13 @@ export default {
   shortcut,
   getDeviceInfo,
   hasCreateShortCut,
+  backCreateShortCut,
   showMenu,
   getShortCut,
   getAppInfo,
   getAppDev,
-  validatePhone
+  validatePhone,
+  getPushRedId,
+  getProvider,
+  mustCreateShort
 };

Plik diff jest za duży
+ 19 - 3
src/manifest.json


+ 29 - 0
src/views/Continue/index.ux

@@ -0,0 +1,29 @@
+<template>
+	<div class="phone-wrap">
+
+	</div>
+</template>
+<script>
+
+import router from '@system.router';
+import storage from '@system.storage';
+
+export default {
+	private: {
+
+
+	},
+	onInit() {
+		this.getLastCharpt();
+	},
+
+	async getLastCharpt() {
+		let params = (await storage.get({ key: "lastCapter" })).data;
+		router.replace({
+			uri: "/views/Reader",
+			params: JSON.parse(params)
+		})
+	}
+
+}
+</script>

+ 37 - 6
src/views/Index/index.ux

@@ -27,7 +27,8 @@
         </div>
       </div>
     </div>
-    <image src="../../assets/imgs/sign_show.png" class="sign-icon" @click="changeSignPop"> </image>
+    <image src="../../assets/imgs/sign_show.png" class="sign-icon" @click="changeSignPop" if="{{user.is_vip}}" > </image>
+    <image src="../../assets/imgs/rukou.png" class="sign-icon" @click="goTask" if="{{!user.is_vip}}" > </image>
     <sign-page if="{{showSignPop}}"></sign-page>
     <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
     <div class="stack-popup" @click="closeWrap" if="showPopup">
@@ -46,12 +47,18 @@
 <script>
 import clipboard from '@system.clipboard';
 import prompt from '@system.prompt';
+import device from "@system.device";
 import it from "../../helper/interface.js";
-import { getCustomQrcode } from '../../api/index.js';
+import { getCustomQrcode, userAddDsktop,getUserInfo} from '../../api/index.js';
 import { downImg, getStore } from '../../api/utils.js';
+import router from "@system.router";
 export default {
+  public:{
+    curPage : 0
+  },
   protected: {
-    current: 0
+    current: 0,
+    user:{}
   },
   private: {
     tabbar: [
@@ -89,16 +96,24 @@ export default {
     showSignPop: false,
     showShortPop: false,
     cutomerQrcode: '',
-    cutomerName: ''
+    cutomerName: '',
+    brand:''
   },
   onInit() {
     this.$on('dispathEvt', this.changeSignPop);
     this.$watch('current', 'watchCurrent');
     //今日已签到过不在弹框签到
     this.getCoustom();
+    this.getUser();
+    if(this.curPage && this.curPage > 0 ){
+      this.current = this.curPage
+    }
+
   },
-  onShow() {
+  async onShow() {
     const data = this.$app.getAppData('backfrom');
+    let device_info = (await device.getInfo()).data;
+    this.brand = device_info.brand ;
     if(data=='phone'){
       this.current = 1;
       this.$app.setAppData('backfrom','');
@@ -112,6 +127,8 @@ export default {
   shortEnd(value) {
     if (value.detail.msg) {
       prompt.showToast({ message: "用户禁止创建" });
+    }else if(value.detail.installed){
+      prompt.showToast({ message: "添加桌面成功!请前往任务中心领取奖励" });
     }
     this.showShortPop = !value.detail.installed;
   },
@@ -119,9 +136,18 @@ export default {
     console.log("watching", i);
     this.current = i;
   },
+  async getUser(){
+    let user = await getUserInfo();
+    this.user = user;
+  },
+  goTask(){
+    router.push({
+      uri: '/views/Task'
+    })
+  },
   onBackPress() {
     // 退出逻辑
-    if (this.$app.$def.data.backClickCount === 0) {
+    if (this.$app.$def.data.backClickCount === 0  && this.brand!=='vivo') {
       this.$app.$def.data.backClickCount++;
       this.$app.$def.createShortcut();
       return true;
@@ -138,6 +164,11 @@ export default {
     this.showShortPop = false;
   },
   async getCoustom() {
+    userAddDsktop(this.$app.$def.data.backClickCount).then(res=>{
+      //TODO 加桌后统计上报
+    }).catch(r=>{
+       //TODO 失败后统计上报
+    });
     let res = await getCustomQrcode();
     this.cutomerQrcode = res.url;
     this.cutomerName = res.name;

+ 26 - 5
src/views/My/index.ux

@@ -2,9 +2,18 @@
   <div class="user-wrap">
     <div class="user-info__wrap">
       <image src="{{user.head_img}}"></image>
-      <div class="uesr-info__message"><text>ID:{{user.id}}<span if="haslogin">(Tel:{{user.dtel}})</span></text><text class="vip-card" if={{user.is_vip}}>免费阅读卡还剩{{user.vip_days}}</text></div>
+      <div class="uesr-info__message"><text>ID:{{user.id}}<span if="haslogin && loginPhone">(Tel:{{loginPhone}})</span></text><text class="vip-card" if={{user.is_vip}}>免费阅读卡还剩{{user.vip_days}}</text></div>
     </div>
-    <div class="operator-item__wrap">
+    <div class="operator-item__wrap" >
+      <div class="operator-item" @click="pageChange('Task')" if={{!user.is_vip}}>
+        <div class="item-name">
+          <image src="../../assets/imgs/task.png"></image>
+          <text class="orange" >做任务,得奖励</text>
+        </div>
+        <div class="info-text">
+          <image class="arrow" src="../../assets/imgs/arrow-right.png"></image>
+        </div>
+      </div>
       <div class="operator-item">
         <div class="item-name">
           <image src="../../assets/imgs/declining.png"></image>
@@ -53,11 +62,11 @@
       <div class="operator-item" @click="pageChange('Phone')">
         <div class="item-name">
           <image src="../../assets/imgs/binding.png"></image>
-          <text if="{{!haslogin}}"> 登录绑定</text>
+          <text if="{{!(haslogin && loginPhone)}}"> 登录绑定</text>
           <text else >退出登录</text>
         </div>
         <div class="info-text">
-          <text if="{{!haslogin}}">首次绑定登录即送100书币</text>
+          <text if="{{!(haslogin && loginPhone)}}"></text>
           <text else>已绑定手机号</text>
           <image class="arrow" src="../../assets/imgs/arrow-right.png"></image>
         </div>
@@ -81,7 +90,8 @@ export default {
   data() {
     return {
       user: {},
-      haslogin: undefined
+      haslogin: undefined,
+      loginPhone: undefined,
     }
   },
   async onInit() {
@@ -93,7 +103,9 @@ export default {
     user.dtel = user.phone.replace(reg,'$1****$2')
     this.user = user;
     let haslogin = (await storage.get({ key: "hasLogin" })).data;
+    let loginPhone= (await storage.get({ key: "loginPhone" })).data; 
     this.haslogin = haslogin;
+    this.loginPhone = loginPhone.replace(reg,'$1****$2');
   },
   watchPropsChange(v) {
     if (v === 3) this.getUser();
@@ -150,6 +162,15 @@ export default {
               console.log(`handling fail, code = ${code}`)
             }
           })
+          storage.delete({
+            key: 'loginPhone',
+            success: function(data) {
+              console.log('handling success')
+            },
+            fail: function(data, code) {
+              console.log(`handling fail, code = ${code}`)
+            }
+          })
         }
       },
       cancel: function () {

+ 37 - 20
src/views/Pay/index.ux

@@ -90,7 +90,7 @@ export default {
     fee: ""
   },
   private: {
-    curPayType: 1,
+    curPayType: 2,
     curSelect: 0,
     balance: 0,
     send_order_id: 0,
@@ -100,6 +100,7 @@ export default {
     showLoading: false,
     checked: false,
     phone: '',
+    isVip: '',
     last: null,
     payType: [
       {
@@ -139,6 +140,12 @@ export default {
     this.send_order_id = userinfo.send_order_id;
     this.checked = userinfo.is_check;
     this.phone = userinfo.phone;
+    this.isVip = userinfo.is_vip;
+    if (userinfo.pay_mode_default == 'weixin') {
+      this.curPayType = 2;
+    } else {
+      this.curPayType = 1;
+    }
   },
   async initChargeList() {
     this.rechargeList = await getChargeList();
@@ -209,17 +216,16 @@ export default {
       message: "请确认支付结果",
       buttons: [
         {
-          text: "完成",
+          text: "已支付",
           color: "#EF5952"
         },
         {
-          text: "支付遇到问题",
+          text: "重新选择金额",
           color: "#999"
         }
       ],
       success: (data) => {
         if (data.index === 0) this.checkOrder(order);
-        else this.showToastByCode("6004");
       },
       cancel: () => {
         console.log("cancel");
@@ -248,29 +254,40 @@ export default {
     this.getUserInfo();
   },
   onHide() {
-    this.$app.$def.createShortcut(true);
+    //this.$app.$def.createShortcut(true);
   },
-  async onBackPress() {
-    // 查询订单的过程如果用户返回
-    if (this.showLoading) {
-      let ret = await prompt.showDialog({
-        title: "警告",
-        message: "订单正在查询中,是否确认退出?",
+  onBackPress() {
+    if (!this.isVip) {
+      prompt.showDialog({
+        title: '温馨提示',
+        message: '每日完成任务,可以免费获取书币~',
         buttons: [
           {
-            text: "退出",
-            color: "#EF5952"
+            text: '去做任务',
+            color: '#EF5952'
           },
           {
-            text: "取消",
-            color: "#999"
+            text: '我知道了',
+            color: '#999'
+          }
+        ],
+        success: function (data) {
+          if (data.index === 1) {
+            router.back();
+          } else {
+            router.push({
+              uri: '/views/Task'
+            })
           }
-        ]
-      });
-      if (ret.data.index === 1) return true;
-      else router.back();
+
+        },
+        cancel: function () {
+          console.log('取消前往')
+        },
+      })
+      return true;
     }
-    else router.back();
+
   }
 }
 </script>

+ 34 - 14
src/views/Phone/index.ux

@@ -15,26 +15,36 @@
 </template>
 <script>
 import it from '../../helper/interface.js';
-import { sendCode, userBind } from '../../api/index';
+import { sendCode, userBind} from '../../api/index';
 import router from '@system.router';
 import prompt from '@system.prompt';
 import storage from '@system.storage';
+
 export default {
   private: {
     hasSend: false,
     duration: 120,
     mobile: null,
-    code: null
+    code: null,
+    isOnBind:false,
+    isOnsend:false,
 
   },
   onInit() {
 
   },
   async sendMsg() {
+    if(this.isOnsend){
+      return false;
+    }
+    this.isOnsend = true;
     let result = it.validatePhone(this.mobile);
     if (result) {
-      let res = await sendCode({ phone: this.mobile });
-      this.countDown();
+      let res = await sendCode({ phone: this.mobile }).catch((err)=>{this.isOnsend = false});
+      if(res){
+         this.isOnsend = false;
+         this.countDown();
+      }
     } else {
       prompt.showToast({
         message: '手机号格式不正确'
@@ -73,20 +83,30 @@ export default {
       })
       return false;
     }
+    if(this.isOnBind){
+      return false;
+    }
+    this.isOnBind = true;
     let params = {
       phone: this.mobile,
-      code: this.code
+      code: this.code,
+      version:'2.0'
     }
-    let res = await userBind(params);
-     await storage.set({ key: "hasLogin", value: 'hasLogin' });
-     this.$app.setAppData('backfrom','phone');
-    prompt.showToast({
-      message: '登录成功!'
-    })
-    setTimeout(()=>{
-      router.back();
-    },1500)
+    
+    let res = await userBind(params).catch((err)=>{this.isOnBind = false;});
+    if(res){
+      this.isOnBind = false;
+      await storage.set({ key: "hasLogin", value: 'hasLogin' });
+      await storage.set({ key: "loginPhone", value: this.mobile });
 
+      this.$app.setAppData('backfrom','phone');
+      prompt.showToast({
+        message: '登录成功!'
+      })
+      setTimeout(()=>{
+        router.back();
+      },1500)
+    }
   }
 
 }

+ 148 - 77
src/views/Reader/index.ux

@@ -1,48 +1,59 @@
 <import name="short-page" src="../../components/short/index.ux"></import>
  <import name="wechat-page" src="../../components/wechat/index.ux"></import> 
 <template>
-  <div id="reader-content" >
+  <div id="reader-content">
     <stack>
       <div class="reader-wrap" id='list' style="background-color:{{currentColor.color}}">
         <div class="reader-title">
-          <text class="title">{{bookinfo.chapter_name}}</text>
+          <text class="title" style="color:{{isNight=='night'?'#666':'#333'}}">{{bookinfo.chapter_name}}</text>
           <!-- <text class="add-shelf" @click="addShelf">加入书架</text> -->
         </div>
-        <div class="reader-content" @click="showMore">
-          <text class="chapter-text" for='content' style="color:{{currentColor.fontColor}};font-size:{{`${readFontSize}px`}}">{{$item}}</text>
-          <div class="bottom-setting" style="background-color:{{currentColor.btColor}}" show={{showSetting}} @click="stopPop">
+        <div class="reader-content">
+          <div class="readContent" @click="showMore"><text class="chapter-text" for='content' style="color:{{currentColor.fontColor}};font-size:{{`${readFontSize}px`}}">{{$item}}</text></div>
+          <div class="bottom-setting" style="background-color:{{currentColor.btColor}}" if={{showSetting}} @click="stopPop">
             <div class="item-content">
-              <text class="label-min" style="color:{{isNight?'#666':'#1A1A1A'}}">A</text>
+              <text class="label-min" style="color:{{isNight=='night'?'#666':'#333'}}">A</text>
               <slider class="slider" min="30" max="48" step="2" value="{{readFontSize}}" onchange="changeFontSize" style="blockColor: #fff"></slider>
-              <text class="label-max"  style="color:{{isNight?'#666':'#1A1A1A'}}">A</text>
+              <text class="label-max" style="color:{{isNight=='night'?'#666':'#333'}}">A</text>
             </div>
             <div class="item-color">
               <text class="colori" for="colorList" onclick="changeColor($item,undefined)" style="border-color:{{currentColor.color==$item.color? currentBorder: $item.borderColor}};background-color:{{$item.color}};"></text>
-              <text class="color-icon {{ isNight }}" onclick="changeColor(nightColor,isNight)" ></text>
+              <text class="color-icon {{ isNight }}" onclick="changeColor(nightColor,isNight)"></text>
             </div>
             <div class="item-page">
-              <text  @click="getPrevChapter" style="color:{{isNight?'#666':'#1A1A1A'}}">上一章</text>
-              <text  @click="toCatalog"   style="color:{{isNight?'#666':'#1A1A1A'}}">目录</text>
-              <text @click="getNextChapter"   style="color:{{isNight?'#666':'#1A1A1A'}}">下一章</text>
+              <text @click="getPrevChapter" style="color:{{isNight=='night'?'#666':'#333'}}">上一章</text>
+              <text @click="toCatalog" style="color:{{isNight=='night'?'#666':'#333'}}">目录</text>
+              <text @click="getNextChapter" style="color:{{isNight=='night'?'#666':'#333'}}">下一章</text>
             </div>
             <div>
+            </div>
+            <div class="setting-top" style="background-color:{{currentColor.color}}" if={{showSetting}} @click="backRouter">
+              <image src="{{getImgUrl}}" class="back-icon"></image> <text style="color:{{isNight=='night'?'#666':'#333'}}">{{bookinfo.chapter_name}}</text><text style="text-indent:-999px">1</text>
+            </div>
           </div>
-          <div class="setting-top" style="background-color:{{currentColor.color}}" show={{showSetting}}>
-            <text>{{bookinfo.chapter_name}}</text>
+          <div class="reader-operator">
+            <text class="operator prev" @click="getPrevChapter">上一章</text>
+            <text class="operator catalog" @click="toCatalog">目录</text>
+            <text class="operator next" @click="getNextChapter">下一章</text>
           </div>
         </div>
-        <div class="reader-operator">
-          <text class="operator prev" @click="getPrevChapter">上一章</text>
-          <text class="operator catalog" @click="toCatalog">目录</text>
-          <text class="operator next" @click="getNextChapter">下一章</text>
+        <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
+        <!-- <wechat-page></wechat-page> -->
+        <div class='toast' if="{{showtoast}}">
+          <text>正在加载中...</text>
         </div>
-      </div>
-      <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
-      <!-- <wechat-page></wechat-page> -->
-      <div class='toast' if="{{showtoast}}">
-        <text>正在加载中...</text>
-      </div>
     </stack>
+    <div class="mustToask" show="{{showMustTost}}">
+      <div class="mustBox">
+        <text class="title-must">
+          提示
+        </text>
+        <text class="content">
+          添加桌面后方可继续阅读精彩内容
+        </text>
+        <text class="button-must" @click="addDestop">添加到桌面</text>
+      </div>
+    </div>
   </div>
 
 </template>
@@ -52,7 +63,7 @@ import prompt from '@system.prompt';
 import router from "@system.router";
 import storage from '@system.storage';
 import it from "../../helper/interface.js";
-import { getChapters, getIsonshelf, postUserShelfBooks, chapterOrders } from "../../api";
+import { getChapters, getIsonshelf, postUserShelfBooks, chapterOrders, userAddDsktop } from "../../api";
 
 export default {
   // protected: {
@@ -71,26 +82,34 @@ export default {
     content: [],
     showShortPop: false,
     readFontSize: 38,
-    isNight:'sun',
-    showSetting:false,
-    colorList:[
-      {color:'#E6E6E6',borderColor:'#CCC',btColor:'#F2F2F2',isIcon:false},
-      {color:'#EED9BB',borderColor:'#C6A473',btColor:'#FFFBE8',isIcon:false},
-      {color:'#B3E2CB',borderColor:'#68AA8A',btColor:'#D5F2D8',isIcon:false},
-      {color:'#B3D0E2',borderColor:'#6090AE',btColor:'#E8F6FF',isIcon:false},
+    isNight: 'sun',
+    hasShort: false,
+    showSetting: false,
+    force_add_desk_type: 0,
+    showMustTost: false,
+    colorList: [
+      { color: '#E6E6E6', borderColor: '#CCC', btColor: '#F2F2F2', isIcon: false },
+      { color: '#EED9BB', borderColor: '#C6A473', btColor: '#FFFBE8', isIcon: false },
+      { color: '#B3E2CB', borderColor: '#68AA8A', btColor: '#D5F2D8', isIcon: false },
+      { color: '#B3D0E2', borderColor: '#6090AE', btColor: '#E8F6FF', isIcon: false },
     ],
-    currentBorder:'#EE6159',
-    nightColor:{
-      fontColor:'#666',
-      btColor:'#333',
-      color:'#1a1a1a'
+    currentBorder: '#EE6159',
+    nightColor: {
+      fontColor: '#666',
+      btColor: '#333',
+      color: '#1a1a1a'
     },
-    currentColor:{
-      color:'#E6E6E6',btColor:'#F2F2F2',fontColor:'#1a1a1a'
+    currentColor: {
+      color: '#E6E6E6', btColor: '#F2F2F2', fontColor: '#1a1a1a'
+    }
+  },
+  computed: {
+    getImgUrl() {
+      return this.isNight == 'night' ? '../../assets/imgs/white_back.png' : '../../assets/imgs/black_back.png'
     }
   },
   async onInit() {
-    if(this.send_order_id){
+    if (this.send_order_id) {
       await storage.set({ key: "send_order_id", value: this.send_order_id });
     }
     /* let s = (await storage.get({ key: "send_order_id" })).data;
@@ -99,60 +118,74 @@ export default {
     console.log("storage send_order_id", s); */
     await this.getChapters(this.bid, this.chapter_id);
     let setting = (await storage.get({ key: "readSetting" })).data;
-     if(setting){
-       let sets = JSON.parse(setting)
-       this.currentColor = sets;
-       this.isNight = sets.isNight;
-     }
+    if (setting) {
+      let sets = JSON.parse(setting)
+      this.currentColor = sets;
+      this.isNight = sets.isNight;
+    }
     let font = (await storage.get({ key: "readFont" })).data;
-    if(font){
+    if (font) {
       this.readFontSize = font;
     }
+    userAddDsktop(this.$app.$def.data.backClickCount).then(res => {
+      //TODO 加桌后统计上报
+    }).catch(r => {
+      //TODO 失败后统计上报
+    });
+  },
+  backRouter() {
+    it.backCreateShortCut(res => {
+      if (res == 'back') router.back()
+    });
   },
   async onShow() {
-    
     it.getShortCut((value) => {
-      this.showSetting = value;
+      this.showSetting = false;
       this.showShortPop = !value;
+      this.hasShort = value;
     })
-     
+    let params = {
+      bid: this.bid,
+      chapter_id: this.chapter_id,
+    }
+    await storage.set({ key: "lastCapter", value: JSON.stringify(params) });
   },
-  stopPop(evt){
+  stopPop(evt) {
     evt.stopPropagation();
     return;
   },
-  showMore(){
+  showMore() {
     this.showSetting = !this.showSetting;
-    if(this.showSetting){
+    if (this.showSetting) {
       this.showShortPop = false;
-    }else{
-      this.showShortPop = true;
+    } else {
+      if (!this.hasShort) this.showShortPop = true;
     }
   },
-  
-  async changeFontSize(evt){
-    this.readFontSize= evt.progress;
+
+  async changeFontSize(evt) {
+    this.readFontSize = evt.progress;
     await storage.set({ key: "readFont", value: this.readFontSize });
   },
-  async changeColor(item,type){
-    if(type){
-      if(type=='sun'){
-        this.isNight='night';
+  async changeColor(item, type) {
+    if (type) {
+      if (type == 'sun') {
+        this.isNight = 'night';
         this.currentColor = this.nightColor;
-        await storage.set({ key: "readSetting", value: JSON.stringify({...this.nightColor,isNight:'night'}) });
-      }else{
-        this.isNight='sun';
-        this.currentColor = {color:'#E6E6E6',borderColor:'#CCC',btColor:'#F2F2F2',isIcon:false};
-        await storage.set({ key: "readSetting", value: JSON.stringify({...this.currentColor,isNight:'sun'}) });
+        await storage.set({ key: "readSetting", value: JSON.stringify({ ...this.nightColor, isNight: 'night' }) });
+      } else {
+        this.isNight = 'sun';
+        this.currentColor = { color: '#E6E6E6', borderColor: '#CCC', btColor: '#F2F2F2', isIcon: false };
+        await storage.set({ key: "readSetting", value: JSON.stringify({ ...this.currentColor, isNight: 'sun' }) });
       }
-    }else{
-      this.isNight='sun';
+    } else {
+      this.isNight = 'sun';
       this.currentColor = {
-        color:item.color,
-        btColor:item.btColor,
-        fontColor:'#1a1a1a'
+        color: item.color,
+        btColor: item.btColor,
+        fontColor: '#1a1a1a'
       }
-      await storage.set({ key: "readSetting", value: JSON.stringify({...this.currentColor,isNight:'sun'}) });
+      await storage.set({ key: "readSetting", value: JSON.stringify({ ...this.currentColor, isNight: 'sun' }) });
     }
   },
   addShelf() {
@@ -162,14 +195,22 @@ export default {
     })
   },
   shortEnd(value) {
+    if (value.detail.installed) {
+      this.showMustTost = false;
+      prompt.showToast({ message: "添加桌面成功!请前往任务中心领取奖励" });
+    }
     this.showShortPop = !value.detail.installed;
+    this.hasShort = value.detail.installed;
+
   },
   getChapters(bid, chapter_id) {
     this.showtoast = true
     console.log("router length:", router.getLength());
     getChapters({ bid: bid, chapter_id: chapter_id }).then(r => {
+      this.force_add_desk_type = r.force_add_desk_type;
       this.content = r.chapter_content.trim().split(/\n/)
-      this.bookinfo = r
+      this.bookinfo = r;
+      
       // this.$element('list').scrollTo({ index: 0 })
       this.addShelf();
       this.showtoast = false
@@ -238,9 +279,31 @@ export default {
       }
     })
   },
+  addDestop() {
+    it.mustCreateShort(res => {
+      if (res) this.goNext();
+    })
+  },
   getNextChapter(evt) {
     evt.stopPropagation();
-    console.log("get next chapter");
+    let _this = this;
+    if (this.force_add_desk_type == 1) {
+      it.getShortCut(res => {
+
+        if (!res) { this.showMustTost = true; } else {
+          this.goNext();
+        }
+      })
+
+    } else if (this.force_add_desk_type == 2) {
+      this.$app.$def.createShortcut(res => {
+        this.goNext();
+      })
+    } else {
+      this.goNext();
+    }
+  },
+  goNext() {
     if (this.bookinfo.next_cid == 0) {
       router.push({
         uri: "/views/Raderover",
@@ -261,10 +324,18 @@ export default {
     })
   },
   onBackPress() {
-    if (router.getLength() === 1) {
-      router.replace({ uri: "/views/Index" });
-      return true;
-    }
+    it.backCreateShortCut(res => {
+      if (res == 'back') {
+        if (router.getLength() === 1) {
+          router.replace({ uri: "/views/Index" });
+          return true;
+        }else{
+           router.back()
+        }
+      }
+     
+    });
+    return true;
   }
 }
 </script>

+ 226 - 0
src/views/Task/index.ux

@@ -0,0 +1,226 @@
+
+<template>
+	<div class="task-page">
+		<div class="task-banner">
+			<div class="swiper-container">
+				<swiper class="swipe-bar" autoplay="true" indicator="false">
+					<block for="book in bannerList">
+						<div class="swipe-item">
+							<image class="cover" src="{{book.banner_url}}" @click="pageRouter(book)"></image>
+						</div>
+					</block>
+				</swiper>
+			</div>
+		</div>
+		<div class="sign-section">
+			<div class="sign-title" @click="showRules"><text>已连续签到{{signData.signDay}}天</text>
+				<image src="../../assets/imgs/question.png"></image>
+			</div>
+			<text class="sign-desc">连续签到可持续获得高额奖励</text>
+			<div class="sign-line">
+				<div class="sign-line__item" for="{{signList}}">
+					<text class="sign-line__day">{{$item.day}}天</text>
+					<image src="../../assets/imgs/sign_{{$item.iconType}}.jpg"></image>
+					<text class="sign-line__fee">{{$item.fee}}书币</text>
+				</div>
+			</div>
+			<text class="sign-button" @click="signToday" if="{{!signData.is_sign}}">
+				签到
+			</text>
+			<text class="sign-button-disabled" if="{{signData.is_sign}}">
+				已签到
+			</text>
+		</div>
+		<div class="task-section">
+			<div class="task-section__tab">
+				<text class="{{type=='new'?'on':''}}" @click="changeTab('new')">新手任务</text>
+				<text class="{{type=='day'?'on':''}}" @click="changeTab('day')">日常福利</text>
+			</div>
+			<div class="banner">
+				<image src="https://cdn-novel.iycdm.com/quickapp/task/day_task.png" show="{{type=='day'}}"></image>
+				<image src="https://cdn-novel.iycdm.com/quickapp/task/new_task.png" show="{{type=='new'}}"></image>
+			</div>
+			<div class="task-section__list">
+				<div class="list-item" for="{{currentList}}"  @click="compeletTask($item.status,$item.type,$item.id,$item.path)">
+					<image src="{{$item.icon}}" class="icon" />
+					</image>
+					<div class="content">
+						<div><text>{{$item.name}}</text>
+							<div class="task-award">
+								<image src="{{$item.icon}}"></image><text>{{$item.value}}<text>
+							</div>
+						</div>
+						<text class="content-desc">{{$item.desc}}</text>
+					</div>
+					<text class="button-status {{ $item.status==0 ? 'wait': ($item.status==1 ? 'get' : 'disabled') }}">
+						{{$item.status==0?'去完成':$item.status==1?'领取':'已领取'}}
+					</text>
+				</div>
+			</div>
+		</div>
+		<div class="mask" show="{{showRule}}">
+			<div class="rule">
+				<text class="rule-title">签到规则</text>
+				<text class="detail">1.每7天为一个签到周期,用户连续签满7天,完成一个签到周期,下次签到重新计算签到周期 </text>
+				<text class="detail">2.用户连续签到获得的奖励更高,若中途漏签,则从第一天开始重新计算签到周期 </text>
+			</div>
+			<image src="../../assets/imgs/pop_close.png" class="close-icon" @click="closeRule"></image>
+		</div>
+		<div class="mask" if="{{SignSuccess}}">
+			<div class="sign-banner">
+				<text class="sign-banner__text"><span>获得</span><span class="orange">{{ currentFee}}</span><span>书币</span></text>
+			</div>
+			<image src="../../assets/imgs/pop_close.png" class="close-icon" @click="closeSign"></image>
+		</div>
+	</div>
+</template>
+<script>
+import { userTaskList, userAddDsktop, getTaskAward, getSignInfo, noVipSign, taskBook } from "../../api/index";
+import router from "@system.router";
+import shortcut from "@system.shortcut";
+import prompt from '@system.prompt';
+export default {
+	data: {
+		signList: [
+		],
+		currentFee: 0,
+		signData: {},
+		showRule: false,
+		SignSuccess: false,
+		dayList: [],
+		newList: [],
+		type: 'new',
+		bannerList: [],
+		isClick: false,
+	},
+	computed: {
+		currentList() {
+			let curList = this.type == 'new' ? this.newList : this.dayList;
+			return curList;
+		},
+	},
+	onInit() {
+		this.getBook();
+		this.getSignList();
+	},
+	onShow() {
+		this.getTaskList();
+	},
+	async getBook() {
+		let bookList = await taskBook();
+		this.bannerList = bookList;
+	},
+	async getSignList() {
+		let signList = [];
+		let signData = await getSignInfo();
+		signData.reward_list.map((item, idx) => {
+			signList.push({ day: idx + 1, iconType: idx < signData.sign_day ? 'checked' : 'coin', fee: item })
+		})
+		signData.signDay = signData.sign_day;
+		this.currentFee = signData.reward_list[Number(signData.sign_day)];
+		this.signList = signList;
+		this.signData = signData;
+	},
+	async getTaskList() {
+		//每次展示刷新当前任务
+		let list = await userTaskList().catch((err) => { console.log(err) });
+		let dayList = list.date_tasks;
+		let newList = list.new_user_tasks;
+		//TODO数组处理
+		this.dayList = dayList;
+		this.newList = newList;
+	},
+	changeTab(type) {
+		this.type = type;
+	},
+	closeRule() {
+		this.showRule = false;
+	},
+	showRules() {
+		this.showRule = true;
+	},
+	signToday() {
+		noVipSign().then(res => {
+			this.signList[this.signData.sign_day].iconType = 'checked'
+			this.SignSuccess = true;
+			this.signData.signDay++;
+			this.signData.sign_day++;
+			this.signData.is_sign = true;
+			prompt.showToast("恭喜您签到成功!");
+		})
+	},
+	pageRouter(page) {
+		router.push({
+			uri: page.redirect_url,
+			params: {
+				bid: page.bid,
+				chapter_id: page.cid
+			}
+		})
+	},
+	closeSign() {
+		this.SignSuccess = false;
+	},
+	 async compeletTask(status, type, id, path) {
+		if (this.isClick) return false;
+		this.isClick = true;
+		if (status == 2) {
+			this.isClick = false;
+			return false;
+		} else if (status == 0) {
+			this.isClick = false;
+			this.goTask(type, path)
+		} else {
+		let data = await getTaskAward(id);
+		this.getTaskList();
+		this.isClick = false;
+		prompt.showToast("领取成功!");
+		}
+		this.isClick = false;
+	},
+	goTask(type, path) {
+		let _self = this;
+		if (type == 'add_desk') {
+			shortcut.hasInstalled({
+				success: ret => {
+					if (!ret) {
+						shortcut.install({
+							message: "添加【追书云】到桌面,方便下次阅读",
+							success: () => {
+								prompt.showToast("添加成功!");
+								userAddDsktop(1).then(res => {
+									_self.getTaskList();
+								}).catch(r => {
+									//TODO 失败后统计上报
+								});
+
+							},
+							fail: code => {
+								console.log(code)
+							}
+						});
+					} else {
+						userAddDsktop(1).then(res => {
+							_self.getTaskList();
+						}).catch(r => {
+							//TODO 失败后统计上报
+						});
+					}
+				}
+			});
+
+		} else if (path && path != '') {
+			router.push({
+				uri: path
+			})
+		}
+
+	}
+
+}
+</script>
+<style lang="less">
+@import "../../assets/less/task.less";
+</style>
+
+