基本功能
Showing
14 changed files
with
1191 additions
and
35 deletions
| ... | @@ -16,6 +16,11 @@ | ... | @@ -16,6 +16,11 @@ |
| 16 | <strong>We're sorry but vue-cli3-framework doesn't work properly without JavaScript enabled. Please enable it to | 16 | <strong>We're sorry but vue-cli3-framework doesn't work properly without JavaScript enabled. Please enable it to |
| 17 | continue.</strong> | 17 | continue.</strong> |
| 18 | </noscript> | 18 | </noscript> |
| 19 | |||
| 20 | <script src="./js/global-params.js"></script> | ||
| 21 | <script src="./js/jweixin-1.1.0.js"></script> | ||
| 22 | <script src="./js/hdp-4.4.0.min.js"></script> | ||
| 23 | <script src="./js/as.js"></script> | ||
| 19 | <div id="app"></div> | 24 | <div id="app"></div> |
| 20 | <!-- built files will be auto injected --> | 25 | <!-- built files will be auto injected --> |
| 21 | </body> | 26 | </body> | ... | ... |
public/js/as.js
0 → 100644
| 1 | var as = {}; | ||
| 2 | |||
| 3 | /*------------------初始化基础数据 start---------------------*/ | ||
| 4 | as.domains = "https://k.wxpai.cn/F2Mb"; | ||
| 5 | as.AppID = "44beaf75bc0511e98c527cd30aeb749e"; | ||
| 6 | as.AppKey = "8c2ecbf4a75648c8b0cb04940f461c4c"; | ||
| 7 | |||
| 8 | //默认头像 | ||
| 9 | as.defineAvatar = "http://cdn.aiwanpai.com/s/d.jpg"; | ||
| 10 | |||
| 11 | as.shareLink = as.domains + "/index.html"; | ||
| 12 | as.shareImgUrl = as.domains + "/share.jpg"; | ||
| 13 | as.success = function () { }; | ||
| 14 | as.appSuccess = function () { }; | ||
| 15 | |||
| 16 | as.openid = ""; | ||
| 17 | as.wxUserInfo = {}; | ||
| 18 | as.isSubscribe = false; //是否关注 | ||
| 19 | as.rankName = "rank"; //排行榜名称 | ||
| 20 | /*------------------初始化基础数据 end-----------------------*/ | ||
| 21 | |||
| 22 | /*------------------HDP初始化 start---------------------*/ | ||
| 23 | HDP.init(as.AppID, as.AppKey); | ||
| 24 | weixinGetConfig(); | ||
| 25 | |||
| 26 | hideOptionMenu(); | ||
| 27 | //隐藏分享到朋友圈 | ||
| 28 | // hideMenuItemsTimeLink(); | ||
| 29 | //隐藏微信右上角菜单 | ||
| 30 | // hideOptionMenu(); | ||
| 31 | // 批量隐藏功能按钮接口 | ||
| 32 | // hideMenuItems( | ||
| 33 | // [ | ||
| 34 | // "menuItem:share:appMessage", | ||
| 35 | // "menuItem:share:timeline", | ||
| 36 | // "menuItem:share:qq", | ||
| 37 | // "menuItem:share:weiboApp", | ||
| 38 | // "menuItem:favorite", | ||
| 39 | // "menuItem:share:facebook", | ||
| 40 | // "menuItem:share:QZone", | ||
| 41 | // "menuItem:editTag", | ||
| 42 | // "menuItem:delete", | ||
| 43 | // "menuItem:copyUrl", | ||
| 44 | // "menuItem:originPage", | ||
| 45 | // "menuItem:readMode", | ||
| 46 | // "menuItem:openWithQQBrowser", | ||
| 47 | // "menuItem:openWithSafari", | ||
| 48 | // "menuItem:share:email", | ||
| 49 | // "menuItem:share:brand" | ||
| 50 | // ] | ||
| 51 | // ); | ||
| 52 | |||
| 53 | //以下初始化不需要使用可以注释掉 | ||
| 54 | as.weixin = HDP.weixin(); //微信 | ||
| 55 | as.redis = HDP.redis(); //keyvaluestore | ||
| 56 | as.func = HDP.getFunction(); //自定义函数 | ||
| 57 | as.rand = HDP.rand(); //抽奖 | ||
| 58 | // as.piplus = HDP.getPiplus(); //派加接口 | ||
| 59 | as.co = HDP.getAppCooperation(); //协作 | ||
| 60 | // as.rank = HDP.rank(); //排行榜 | ||
| 61 | // as.jpgCdn = HDP.getJpgCDN(); //图片路径转换 | ||
| 62 | as.wxMultimedia = HDP.wxMultimedia(); //语音 | ||
| 63 | as.file = HDP.getFile(); //上传图片 | ||
| 64 | /*------------------HDP初始化 end-----------------------*/ | ||
| 65 | |||
| 66 | /*------------------微信相关 start---------------------*/ | ||
| 67 | //分享设置 | ||
| 68 | as.setShare = function (link, title, desc, imgurl) { | ||
| 69 | as.weixin.initShare({ | ||
| 70 | "link": (link != "") ? link : as.shareLink, | ||
| 71 | "appMessageTitle": (title != "") ? title : as.shareTitle, | ||
| 72 | "appMessageDesc": (desc != "") ? desc : as.shareDesc, | ||
| 73 | "appMessageImgUrl": (imgurl != "") ? imgurl : as.shareImgUrl, | ||
| 74 | "appMessageShareSucc": as.appSuccess, | ||
| 75 | |||
| 76 | "timelineTitle": (desc != "") ? desc : as.shareDesc, | ||
| 77 | "timelineImgUrl": (imgurl != "") ? imgurl : as.shareImgUrl, | ||
| 78 | "timelineShareSucc": as.success | ||
| 79 | }); | ||
| 80 | }; | ||
| 81 | as.setShare("", "了解「亚洲万里通」", "", "https://k.wxpai.cn/saMS/share.jpg?v20190625"); | ||
| 82 | //获取用户微信信息 | ||
| 83 | as.getWxUserInfo = function (callback) { | ||
| 84 | as.weixin.getUserInfoV2({ | ||
| 85 | "success": function (res) { | ||
| 86 | if (res && res.nickname) { | ||
| 87 | if (res.nickname.indexOf('"') > -1) { | ||
| 88 | res.nickname = res.nickname.replace(/"/g, '“'); | ||
| 89 | } | ||
| 90 | if (res.nickname.indexOf("'") > -1) { | ||
| 91 | res.nickname = res.nickname.replace(/'/g, "‘"); | ||
| 92 | } | ||
| 93 | } | ||
| 94 | if (res && res.avatar == "") { | ||
| 95 | res.avatar = as.defineAvatar; | ||
| 96 | } | ||
| 97 | as.wxUserInfo = res; | ||
| 98 | if (as.wxUserInfo && as.wxUserInfo.openid) { | ||
| 99 | as.openid = as.wxUserInfo.openid; | ||
| 100 | } | ||
| 101 | |||
| 102 | if (typeof callback == "function") { | ||
| 103 | callback(as.openid) | ||
| 104 | }; | ||
| 105 | }, | ||
| 106 | "error": function (res) { | ||
| 107 | if (typeof callback == "function") { | ||
| 108 | callback("") | ||
| 109 | }; | ||
| 110 | } | ||
| 111 | }); | ||
| 112 | }; | ||
| 113 | //判断是否关注了公众号 | ||
| 114 | as.isAttention = function (callback) { | ||
| 115 | as.weixin.isSubscribe({ | ||
| 116 | "success": function (res) { | ||
| 117 | as.isSubscribe = (res["subscribe"] == 1) ? true : false; | ||
| 118 | if (typeof callback == "function") | ||
| 119 | callback(as.isSubscribe); | ||
| 120 | }, | ||
| 121 | "error": function (res) { | ||
| 122 | if (typeof callback == "function") | ||
| 123 | callback(false); | ||
| 124 | } | ||
| 125 | }); | ||
| 126 | }; | ||
| 127 | //领取卡券 | ||
| 128 | as.addCard = function (cardId, openid, callback) { | ||
| 129 | as.weixin.addCard({ | ||
| 130 | "cardId": cardId, | ||
| 131 | "code": "", | ||
| 132 | "openid": openid, | ||
| 133 | "succ": function (res) { | ||
| 134 | console.log('领取卡券成功'); | ||
| 135 | if (typeof callback == "function") | ||
| 136 | callback(true); | ||
| 137 | }, | ||
| 138 | "error": function (res) { | ||
| 139 | console.log('领取卡券失败'); | ||
| 140 | if (typeof callback == "function") | ||
| 141 | callback(false); | ||
| 142 | } | ||
| 143 | }); | ||
| 144 | }; | ||
| 145 | /*------------------微信相关 end---------------------*/ | ||
| 146 | |||
| 147 | /*------------------keyvaluestore start---------------------*/ | ||
| 148 | as.setRedisKeyValue = function (key, value, callback) { | ||
| 149 | var redisOp = { | ||
| 150 | "param": { | ||
| 151 | "valueKey": key, | ||
| 152 | "value": value | ||
| 153 | }, | ||
| 154 | "success": function (res) { | ||
| 155 | var bool = res.code == "180001"; | ||
| 156 | if (typeof callback == "function") callback(bool); | ||
| 157 | }, | ||
| 158 | "error": function (res) { | ||
| 159 | if (typeof callback == "function") callback(false); | ||
| 160 | } | ||
| 161 | }; | ||
| 162 | as.redis.set(redisOp); | ||
| 163 | }; | ||
| 164 | as.getRedisKeyValue = function (key, callback) { | ||
| 165 | var redisOp = { | ||
| 166 | "param": { | ||
| 167 | "valueKey": key | ||
| 168 | }, | ||
| 169 | "success": function (res) { | ||
| 170 | if (res.code == "181001") { | ||
| 171 | if (typeof callback == "function") callback(res["returnMap"][key]); | ||
| 172 | } else { | ||
| 173 | if (typeof callback == "function") callback(null); | ||
| 174 | } | ||
| 175 | }, | ||
| 176 | "error": function (res) { | ||
| 177 | if (typeof callback == "function") callback(null); | ||
| 178 | } | ||
| 179 | }; | ||
| 180 | as.redis.get(redisOp); | ||
| 181 | }; | ||
| 182 | as.getRedisList = function (key, callback) { | ||
| 183 | var redisOp = { | ||
| 184 | "param": { | ||
| 185 | "valueKey": key | ||
| 186 | }, | ||
| 187 | "success": function (res) { | ||
| 188 | if (res.code == "181001") { | ||
| 189 | if (typeof callback == "function") callback(res["returnMap"]); | ||
| 190 | } else { | ||
| 191 | if (typeof callback == "function") callback(null); | ||
| 192 | } | ||
| 193 | }, | ||
| 194 | "error": function (res) { | ||
| 195 | if (typeof callback == "function") callback(null); | ||
| 196 | } | ||
| 197 | }; | ||
| 198 | as.redis.getList(redisOp); | ||
| 199 | }; | ||
| 200 | /*------------------keyvaluestore end-----------------------*/ | ||
| 201 | |||
| 202 | /*------------------自定义函数 start---------------------*/ | ||
| 203 | //单语句查询 | ||
| 204 | as.queryFun = function (funName, data, callback) { | ||
| 205 | as.func.runFunction(funName, { | ||
| 206 | "param": data, | ||
| 207 | "success": function (res) { | ||
| 208 | if (typeof callback == "function") callback(res); | ||
| 209 | }, | ||
| 210 | "error": function (res) { | ||
| 211 | if (typeof callback == "function") callback(null); | ||
| 212 | } | ||
| 213 | }); | ||
| 214 | }; | ||
| 215 | //插入,修改,多语句查询 | ||
| 216 | as.queryFunV2 = function (funName, data, callback) { | ||
| 217 | as.func.runFunctionV2(funName, { | ||
| 218 | "param": data, | ||
| 219 | "success": function (res) { | ||
| 220 | if (typeof callback == "function") callback(res); | ||
| 221 | }, | ||
| 222 | "error": function (res) { | ||
| 223 | if (typeof callback == "function") callback(null); | ||
| 224 | } | ||
| 225 | }); | ||
| 226 | }; | ||
| 227 | /*------------------自定义函数 end---------------------*/ | ||
| 228 | |||
| 229 | /*------------------抽奖相关 start---------------------*/ | ||
| 230 | //抽奖 | ||
| 231 | as.gameLottery = function (callback) { | ||
| 232 | as.rand.rand({ | ||
| 233 | "success": function (res) { | ||
| 234 | if (typeof callback == "function") callback(res); | ||
| 235 | }, | ||
| 236 | "error": function (res) { | ||
| 237 | if (typeof callback == "function") callback({ | ||
| 238 | "result": false | ||
| 239 | }); | ||
| 240 | } | ||
| 241 | }); | ||
| 242 | }; | ||
| 243 | //时间戳格式化(YYYY-mm-dd) | ||
| 244 | as.timestampFormat = function (timestamp) { | ||
| 245 | var myDate = new Date(); | ||
| 246 | if (timestamp) myDate.setTime(timestamp); | ||
| 247 | var year = myDate.getFullYear(); | ||
| 248 | var month = myDate.getMonth() + 1; | ||
| 249 | if (month < 10) month = "0" + month; | ||
| 250 | var day = myDate.getDate(); | ||
| 251 | if (day < 10) day = "0" + day; | ||
| 252 | |||
| 253 | var format = ""; | ||
| 254 | format += year + "-" + month + "-" + day; | ||
| 255 | return format; | ||
| 256 | }; | ||
| 257 | /*------------------抽奖相关 end-----------------------*/ | ||
| 258 | |||
| 259 | /*------------------协作相关 start---------------------*/ | ||
| 260 | //从当前链接中获取邀请码 hdp_cooperation_id | ||
| 261 | as.getCodeFromCurrentUrl = function (callback) { | ||
| 262 | as.co.getCodeFromCurrentUrl(function (cooperationId) { | ||
| 263 | if (typeof callback == "function") callback(cooperationId); | ||
| 264 | }); | ||
| 265 | }; | ||
| 266 | //根据邀请码重置分享链接 | ||
| 267 | as.cooperationSetShareLink = function (resourceId, desc) { | ||
| 268 | if (resourceId != "") { | ||
| 269 | if (as.shareLink.indexOf("?") > 0) { | ||
| 270 | var link = as.shareLink + "&hdp_cooperation_id=" + resourceId; | ||
| 271 | } else { | ||
| 272 | var link = as.shareLink + "?hdp_cooperation_id=" + resourceId; | ||
| 273 | } | ||
| 274 | as.setShare(link, "", desc, ""); | ||
| 275 | } | ||
| 276 | }; | ||
| 277 | //生成邀请码 | ||
| 278 | as.insertResourceId = function (jsonStr, callback) { | ||
| 279 | if (typeof (jsonStr) != 'string') { | ||
| 280 | jsonStr = JSON.stringify(jsonStr); | ||
| 281 | } | ||
| 282 | as.co.uploadAppCooperationInfo({ | ||
| 283 | "param": { | ||
| 284 | "jsonStr": jsonStr | ||
| 285 | }, | ||
| 286 | "success": function (res) { | ||
| 287 | if (res && res.success) { | ||
| 288 | if (typeof callback == "function") callback(res.content); | ||
| 289 | } else { | ||
| 290 | if (typeof callback == "function") callback(""); | ||
| 291 | } | ||
| 292 | }, | ||
| 293 | "error": function (res) { | ||
| 294 | if (typeof callback == "function") callback(""); | ||
| 295 | } | ||
| 296 | }); | ||
| 297 | }; | ||
| 298 | //判断当前邀请码状态,分辨邀请者身份 | ||
| 299 | as.checkResourceId = function (resourceId, callback) { | ||
| 300 | as.co.checkAppCooperationInfoSelfOrNot({ | ||
| 301 | "param": { | ||
| 302 | "resourceId": resourceId | ||
| 303 | }, | ||
| 304 | "success": function (res) { | ||
| 305 | if (res && res.success) { | ||
| 306 | //res.content :"not exist"非邀请链接;"true"自己的分享链接;"false"他人的分享链接 | ||
| 307 | if (typeof callback == "function") callback(res.content); | ||
| 308 | } else { | ||
| 309 | if (typeof callback == "function") callback("not exist"); | ||
| 310 | } | ||
| 311 | }, | ||
| 312 | "error": function (res) { | ||
| 313 | if (typeof callback == "function") callback("not exist"); | ||
| 314 | } | ||
| 315 | }); | ||
| 316 | }; | ||
| 317 | //读取用户所有邀请码 | ||
| 318 | as.getResourceId = function (callback) { | ||
| 319 | as.co.queryCurrentUserAppCooperationInfoIdList({ | ||
| 320 | "success": function (res) { | ||
| 321 | if (typeof callback == "function") callback(res); | ||
| 322 | }, | ||
| 323 | "error": function (res) { | ||
| 324 | if (typeof callback == "function") callback([]); | ||
| 325 | } | ||
| 326 | }); | ||
| 327 | }; | ||
| 328 | //读取当前邀请码信息 | ||
| 329 | as.getUserInfoByResourceId = function (resourceId, callback) { | ||
| 330 | as.co.queryCurrentAppCooperationInfo({ | ||
| 331 | "param": { | ||
| 332 | "resourceId": resourceId | ||
| 333 | }, | ||
| 334 | "success": function (res) { | ||
| 335 | if (typeof callback == "function") callback(res); | ||
| 336 | }, | ||
| 337 | "error": function (res) { | ||
| 338 | if (typeof callback == "function") callback(null); | ||
| 339 | } | ||
| 340 | }); | ||
| 341 | }; | ||
| 342 | //为邀请码点赞 | ||
| 343 | as.addPraise = function (resourceId, callback) { | ||
| 344 | as.co.praise({ | ||
| 345 | "param": { | ||
| 346 | "resourceId": resourceId | ||
| 347 | }, | ||
| 348 | "success": function (res) { | ||
| 349 | if (typeof callback == "function") callback(res); | ||
| 350 | }, | ||
| 351 | "error": function (res) { | ||
| 352 | if (typeof callback == "function") callback(false); | ||
| 353 | } | ||
| 354 | }); | ||
| 355 | }; | ||
| 356 | //读取邀请码的点赞数 | ||
| 357 | as.getPraise = function (resourceId, callback) { | ||
| 358 | as.co.getPraiseRecordTotalByResourceId({ | ||
| 359 | "param": { | ||
| 360 | "resourceId": resourceId | ||
| 361 | }, | ||
| 362 | "success": function (res) { | ||
| 363 | if (typeof callback == "function") callback(res); | ||
| 364 | }, | ||
| 365 | "error": function (res) { | ||
| 366 | if (typeof callback == "function") callback(0); | ||
| 367 | } | ||
| 368 | }); | ||
| 369 | }; | ||
| 370 | //判断用户是否为邀请码点赞 | ||
| 371 | as.checkUserPraise = function (resourceId, callback) { | ||
| 372 | as.co.checkCurrentUserPraiseOrNot({ | ||
| 373 | "param": { | ||
| 374 | "resourceId": resourceId | ||
| 375 | }, | ||
| 376 | "success": function (res) { | ||
| 377 | if (typeof callback == "function") callback(res); | ||
| 378 | }, | ||
| 379 | "error": function (res) { | ||
| 380 | if (typeof callback == "function") callback(false); | ||
| 381 | } | ||
| 382 | }); | ||
| 383 | }; | ||
| 384 | as.getPraiseLog = function (resourceId, page, size, callback) { | ||
| 385 | as.co.queryPraiseRecordListByResourceId({ | ||
| 386 | "param": { | ||
| 387 | "resourceId": resourceId, | ||
| 388 | "page": page, | ||
| 389 | "size": size | ||
| 390 | }, | ||
| 391 | "success": function (res) { | ||
| 392 | if (typeof callback == "function") callback(res); | ||
| 393 | }, | ||
| 394 | "error": function (res) { | ||
| 395 | if (typeof callback == "function") callback([]); | ||
| 396 | } | ||
| 397 | }); | ||
| 398 | }; | ||
| 399 | //为邀请码评论 | ||
| 400 | as.addComment = function (resourceId, content, callback) { | ||
| 401 | as.co.comment({ | ||
| 402 | "param": { | ||
| 403 | "resourceId": resourceId, | ||
| 404 | "content": content, | ||
| 405 | "parentId": "", | ||
| 406 | "remark": "" | ||
| 407 | }, | ||
| 408 | "success": function (res) { | ||
| 409 | if (typeof callback == "function") callback(res); | ||
| 410 | }, | ||
| 411 | "error": function (res) { | ||
| 412 | if (typeof callback == "function") callback(null); | ||
| 413 | } | ||
| 414 | }); | ||
| 415 | }; | ||
| 416 | //评论列表 | ||
| 417 | as.queryCommentList = function (resourceId, page, size, callback) { | ||
| 418 | as.co.queryAppCooperationInfoCommentRecordList({ | ||
| 419 | "param": { | ||
| 420 | "resourceId": resourceId, | ||
| 421 | "page": page, | ||
| 422 | "size": size, | ||
| 423 | "ascending": false | ||
| 424 | }, | ||
| 425 | "success": function (res) { | ||
| 426 | if (typeof callback == "function") callback(res); | ||
| 427 | }, | ||
| 428 | "error": function (res) { | ||
| 429 | if (typeof callback == "function") callback([]); | ||
| 430 | } | ||
| 431 | }); | ||
| 432 | }; | ||
| 433 | //读取邀请码评论数 | ||
| 434 | as.queryCommentCount = function (resourceId, callback) { | ||
| 435 | as.co.getAppCooperationInfoCommentRecordTotal({ | ||
| 436 | "param": { | ||
| 437 | "resourceId": resourceId | ||
| 438 | }, | ||
| 439 | "success": function (res) { | ||
| 440 | if (typeof callback == "function") callback(res); | ||
| 441 | }, | ||
| 442 | "error": function (res) { | ||
| 443 | if (typeof callback == "function") callback(0); | ||
| 444 | } | ||
| 445 | }); | ||
| 446 | }; | ||
| 447 | //当前用户对邀请码的评论总数 | ||
| 448 | as.queryCommentCountByUser = function (resourceId, callback) { | ||
| 449 | as.co.getCurrentUserAppCooperationInfoCommentRecordTotal({ | ||
| 450 | "param": { | ||
| 451 | "resourceId": resourceId | ||
| 452 | }, | ||
| 453 | "success": function (res) { | ||
| 454 | if (typeof callback == "function") callback(res); | ||
| 455 | }, | ||
| 456 | "error": function (res) { | ||
| 457 | if (typeof callback == "function") callback(0); | ||
| 458 | } | ||
| 459 | }); | ||
| 460 | }; | ||
| 461 | /*------------------协作相关 end-----------------------*/ | ||
| 462 | |||
| 463 | /*------------------排行榜相关 start---------------------*/ | ||
| 464 | /* | ||
| 465 | * 提交成绩 | ||
| 466 | * rankName : 排行榜名字 | ||
| 467 | * score : 游戏分数 | ||
| 468 | * spendTime : 游戏耗时 | ||
| 469 | */ | ||
| 470 | as.rankSubmitScore = function (score, spendTime, callback) { | ||
| 471 | as.rank.saveRankScore({ | ||
| 472 | "param": { | ||
| 473 | "rankName": as.rankName, | ||
| 474 | "score": score, | ||
| 475 | "spendTime": spendTime | ||
| 476 | }, | ||
| 477 | "success": function (res) { | ||
| 478 | if (typeof callback == "function") callback(res); | ||
| 479 | }, | ||
| 480 | "error": function (res) { | ||
| 481 | if (typeof callback == "function") callback(null); | ||
| 482 | } | ||
| 483 | }); | ||
| 484 | }; | ||
| 485 | //查询排行榜(包含当前用户的排行记录) | ||
| 486 | as.rankQueryRankList = function (page, size, callback) { | ||
| 487 | as.rank.queryRankList({ | ||
| 488 | "param": { | ||
| 489 | "rankName": as.rankName, | ||
| 490 | "selfInclude": true, | ||
| 491 | "page": page, | ||
| 492 | "size": size | ||
| 493 | }, | ||
| 494 | "success": function (res) { | ||
| 495 | if (typeof callback == "function") callback(res); | ||
| 496 | }, | ||
| 497 | "error": function (res) { | ||
| 498 | if (typeof callback == "function") callback(null); | ||
| 499 | } | ||
| 500 | }); | ||
| 501 | }; | ||
| 502 | //查询当前用户排名 | ||
| 503 | as.rankQueryUserRankRecord = function (callback) { | ||
| 504 | as.rank.queryUserRankRecord({ | ||
| 505 | "param": { | ||
| 506 | "rankName": as.rankName | ||
| 507 | }, | ||
| 508 | "success": function (res) { | ||
| 509 | if (typeof callback == "function") callback(res); | ||
| 510 | }, | ||
| 511 | "error": function (res) { | ||
| 512 | if (typeof callback == "function") callback(null); | ||
| 513 | } | ||
| 514 | }); | ||
| 515 | }; | ||
| 516 | //查询当前用户的记录 | ||
| 517 | as.rankQueryRankHistory = function (callback) { | ||
| 518 | as.rank.queryRankHistory({ | ||
| 519 | "param": { | ||
| 520 | "rankName": as.rankName | ||
| 521 | }, | ||
| 522 | "success": function (res) { | ||
| 523 | console.log(res, "rankQueryUserRankRecord success"); | ||
| 524 | if (typeof callback == "function") callback(res); | ||
| 525 | }, | ||
| 526 | "error": function (res) { | ||
| 527 | console.log(res.response, "rankQueryUserRankRecord error"); | ||
| 528 | if (typeof callback == "function") callback(null); | ||
| 529 | } | ||
| 530 | }); | ||
| 531 | }; | ||
| 532 | /*------------------排行榜相关 end-----------------------*/ | ||
| 533 | |||
| 534 | /*------------------派加接口相关 start---------------------*/ | ||
| 535 | //读取用户积分 | ||
| 536 | as.getIntegral = function (callback) { | ||
| 537 | as.piplus.readUserIntegral({ | ||
| 538 | "success": function (res) { | ||
| 539 | if (res && res.integral) { | ||
| 540 | if (typeof callback == "function") callback(res.integral); | ||
| 541 | } else { | ||
| 542 | if (typeof callback == "function") callback(0); | ||
| 543 | } | ||
| 544 | }, | ||
| 545 | "error": function (res) { | ||
| 546 | if (typeof callback == "function") callback(0); | ||
| 547 | } | ||
| 548 | }); | ||
| 549 | }; | ||
| 550 | //判断当前用户是否会员 | ||
| 551 | as.checkMember = function (callback) { | ||
| 552 | as.piplus.isMember({ | ||
| 553 | "success": function (res) { | ||
| 554 | if (typeof callback == "function") callback(res); | ||
| 555 | }, | ||
| 556 | "error": function (res) { | ||
| 557 | if (typeof callback == "function") callback({ | ||
| 558 | "isMember": false, | ||
| 559 | "integral": 0 | ||
| 560 | }); | ||
| 561 | } | ||
| 562 | }); | ||
| 563 | }; | ||
| 564 | //查询当前用户会员信息 | ||
| 565 | as.readMember = function (callback) { | ||
| 566 | as.piplus.readMember({ | ||
| 567 | "success": function (res) { | ||
| 568 | if (typeof callback == "function") callback(res); | ||
| 569 | }, | ||
| 570 | "error": function (res) { | ||
| 571 | if (typeof callback == "function") callback({ | ||
| 572 | "status": false | ||
| 573 | }); | ||
| 574 | } | ||
| 575 | }); | ||
| 576 | }; | ||
| 577 | //同步会员信息 | ||
| 578 | as.commonSaveUserInfo = function (user_name, mobile, province, city, area, address, birthday, tags, callback) { | ||
| 579 | as.piplus.commonSaveUserInfo({ | ||
| 580 | "param": { | ||
| 581 | "user_name": user_name, | ||
| 582 | "mobile": mobile, | ||
| 583 | "province": province, | ||
| 584 | "city": city, | ||
| 585 | "area": area, | ||
| 586 | "address": address, | ||
| 587 | "birthday": birthday, | ||
| 588 | "tags": tags | ||
| 589 | }, | ||
| 590 | "success": function (res) { | ||
| 591 | if (typeof callback == "function") callback(res); | ||
| 592 | }, | ||
| 593 | "error": function (res) { | ||
| 594 | if (typeof callback == "function") callback({ | ||
| 595 | "status": false | ||
| 596 | }); | ||
| 597 | } | ||
| 598 | }); | ||
| 599 | }; | ||
| 600 | //获取省份 | ||
| 601 | as.getProvinces = function (callback) { | ||
| 602 | as.piplus.getProvinces({ | ||
| 603 | "success": function (res) { | ||
| 604 | if (res.http_status && res.errmsg == "success") { | ||
| 605 | if (typeof callback == "function") callback(res.data); | ||
| 606 | } else { | ||
| 607 | if (typeof callback == "function") callback([]); | ||
| 608 | } | ||
| 609 | }, | ||
| 610 | "error": function (res) { | ||
| 611 | if (typeof callback == "function") callback([]); | ||
| 612 | } | ||
| 613 | }); | ||
| 614 | }; | ||
| 615 | //获取城市 | ||
| 616 | as.getCity = function (regionId, callback) { | ||
| 617 | as.piplus.getCity({ | ||
| 618 | "param": { | ||
| 619 | "regionId": regionId | ||
| 620 | }, | ||
| 621 | "success": function (res) { | ||
| 622 | if (res.http_status && res.errmsg == "success") { | ||
| 623 | if (typeof callback == "function") callback(res.data); | ||
| 624 | } else { | ||
| 625 | if (typeof callback == "function") callback([]); | ||
| 626 | } | ||
| 627 | }, | ||
| 628 | "error": function (res) { | ||
| 629 | if (typeof callback == "function") callback([]); | ||
| 630 | } | ||
| 631 | }); | ||
| 632 | }; | ||
| 633 | //获取区域 | ||
| 634 | as.getArea = function (regionId, callback) { | ||
| 635 | as.piplus.getCity({ | ||
| 636 | "param": { | ||
| 637 | "regionId": regionId | ||
| 638 | }, | ||
| 639 | "success": function (res) { | ||
| 640 | if (res.http_status && res.errmsg == "success") { | ||
| 641 | if (typeof callback == "function") callback(res.data); | ||
| 642 | } else { | ||
| 643 | if (typeof callback == "function") callback([]); | ||
| 644 | } | ||
| 645 | }, | ||
| 646 | "error": function (res) { | ||
| 647 | if (typeof callback == "function") callback([]); | ||
| 648 | } | ||
| 649 | }); | ||
| 650 | }; | ||
| 651 | /*------------------派加接口相关 end-----------------------*/ | ||
| 652 | |||
| 653 | /*------------------图片路径转换 start---------------------*/ | ||
| 654 | as.getJpgCdnUrl = function (imgUrl, callback) { | ||
| 655 | as.jpgCdn.getJpgCDNUrl({ | ||
| 656 | "param": { | ||
| 657 | "imgUrl": imgUrl | ||
| 658 | }, | ||
| 659 | "success": function (res) { | ||
| 660 | if (res && res.success) { | ||
| 661 | if (typeof callback == "function") callback(res.content); | ||
| 662 | } else { | ||
| 663 | if (typeof callback == "function") callback(null); | ||
| 664 | } | ||
| 665 | }, | ||
| 666 | "error": function (res) { | ||
| 667 | if (typeof callback == "function") callback(null); | ||
| 668 | } | ||
| 669 | }); | ||
| 670 | }; | ||
| 671 | as.getCdnImg = function (imgName, callback) { | ||
| 672 | if (typeof callback == "function") | ||
| 673 | callback(as.jpgCdn.getCDNImg(imgName)); | ||
| 674 | }; | ||
| 675 | as.designImg = function (imgName, height, callback) { | ||
| 676 | if (typeof callback == "function") | ||
| 677 | callback(as.jpgCdn.designImg(imgName, height)); | ||
| 678 | }; | ||
| 679 | /*------------------图片路径转换 end-----------------------*/ | ||
| 680 | |||
| 681 | /*------------------上传照片相关 start---------------------*/ | ||
| 682 | as.uploadBase64 = function (base64, callback) { | ||
| 683 | as.file.uploadBase64(base64, as.AppID, { | ||
| 684 | "success": function (res) { | ||
| 685 | var obj = { | ||
| 686 | "result": true, | ||
| 687 | "data": res | ||
| 688 | }; | ||
| 689 | if (typeof callback == "function") callback(obj); | ||
| 690 | }, | ||
| 691 | "error": function (res) { | ||
| 692 | if (typeof callback == "function") callback({ | ||
| 693 | "result": false | ||
| 694 | }); | ||
| 695 | } | ||
| 696 | }); | ||
| 697 | }; | ||
| 698 | /*------------------上传照片相关 end-----------------------*/ | ||
| 699 | |||
| 700 | /*------------------微信语音 start---------------------*/ | ||
| 701 | //开始录音 | ||
| 702 | as.startRecord = function (callback) { | ||
| 703 | if (typeof wx != "undefined" && wx != void 0) { | ||
| 704 | var completeFn = function (res) { | ||
| 705 | if (res["errMsg"] == "startRecord:ok") { | ||
| 706 | if (typeof callback == "function") callback(true); | ||
| 707 | } | ||
| 708 | } | ||
| 709 | |||
| 710 | wx.startRecord({ | ||
| 711 | cancel: function () { | ||
| 712 | alert('用户拒绝授权录音'); | ||
| 713 | if (typeof callback == "function") callback(false); | ||
| 714 | }, | ||
| 715 | complete: completeFn, | ||
| 716 | }); | ||
| 717 | // if (typeof callback == "function") callback(true); | ||
| 718 | } else { | ||
| 719 | if (typeof callback == "function") callback(false); | ||
| 720 | } | ||
| 721 | }; | ||
| 722 | //停止录音 | ||
| 723 | as.stopRecord = function (callback) { | ||
| 724 | if (typeof wx != "undefined" && wx != void 0) { | ||
| 725 | wx.stopRecord({ | ||
| 726 | success: function (res) { | ||
| 727 | if (typeof callback == "function") callback(res.localId); | ||
| 728 | } | ||
| 729 | }); | ||
| 730 | } else { | ||
| 731 | if (typeof callback == "function") callback(""); | ||
| 732 | } | ||
| 733 | }; | ||
| 734 | //上传语音到微信服务器 | ||
| 735 | as.uploadVoice = function (localId, callback) { | ||
| 736 | if (typeof wx != "undefined" && wx != void 0 && localId != "") { | ||
| 737 | wx.uploadVoice({ | ||
| 738 | "localId": localId, // 需要上传的音频的本地ID,由stopRecord接口获得 | ||
| 739 | "isShowProgressTips": 1, // 默认为1,显示进度提示 | ||
| 740 | "success": function (res) { | ||
| 741 | if (typeof callback == "function") callback(res.serverId); | ||
| 742 | } | ||
| 743 | }); | ||
| 744 | } else { | ||
| 745 | if (typeof callback == "function") callback(""); | ||
| 746 | } | ||
| 747 | }; | ||
| 748 | //下载微信服务语音到本地 | ||
| 749 | as.downloadVoice = function (serverId, callback) { | ||
| 750 | if (typeof wx != "undefined" && wx != void 0 && serverId != "") { | ||
| 751 | wx.downloadVoice({ | ||
| 752 | "serverId": serverId, // 需要下载的音频的服务器端ID,由uploadVoice接口获得 | ||
| 753 | "isShowProgressTips": 1, // 默认为1,显示进度提示 | ||
| 754 | "success": function (res) { | ||
| 755 | if (res && res.localId) { | ||
| 756 | if (typeof callback === "function") callback(res.localId); | ||
| 757 | } else { | ||
| 758 | if (typeof callback === "function") callback(""); | ||
| 759 | } | ||
| 760 | } | ||
| 761 | }); | ||
| 762 | } else { | ||
| 763 | if (typeof callback === "function") callback(""); | ||
| 764 | } | ||
| 765 | }; | ||
| 766 | |||
| 767 | //保存录音 | ||
| 768 | as.saveUserVoice = function (vid, serverId, callback) { | ||
| 769 | as.wxMultimedia.record({ | ||
| 770 | "param": { | ||
| 771 | "vId": vid, | ||
| 772 | "serverId": serverId | ||
| 773 | }, | ||
| 774 | "success": function (res) { | ||
| 775 | if (res && res.code == 10000) { | ||
| 776 | if (typeof callback == "function") callback(true); | ||
| 777 | } else { | ||
| 778 | if (typeof callback == "function") callback(false); | ||
| 779 | } | ||
| 780 | }, | ||
| 781 | "error": function (res) { | ||
| 782 | if (typeof callback == "function") callback(false); | ||
| 783 | } | ||
| 784 | }); | ||
| 785 | }; | ||
| 786 | //读取单个录音 | ||
| 787 | as.getUserVoice = function (vid, callback) { | ||
| 788 | try { | ||
| 789 | as.wxMultimedia.get({ | ||
| 790 | "param": { | ||
| 791 | "vId": vid | ||
| 792 | }, | ||
| 793 | "success": function (res) { | ||
| 794 | if (typeof callback == "function") callback(res); | ||
| 795 | }, | ||
| 796 | "error": function (res) { | ||
| 797 | if (typeof callback == "function") callback(null); | ||
| 798 | } | ||
| 799 | }); | ||
| 800 | } catch (e) { | ||
| 801 | if (typeof callback == "function") callback(null); | ||
| 802 | } | ||
| 803 | }; | ||
| 804 | |||
| 805 | //播放声音 | ||
| 806 | as.playVoice = function (localId, voiceStatus, voiceUrl, serverId, callback) { | ||
| 807 | if (localId != "") { | ||
| 808 | as.playRecord(localId, function () { | ||
| 809 | if (typeof callback == "function") callback(true, null); | ||
| 810 | }); | ||
| 811 | } else if ((voiceStatus == "CONVERT_SUCCESS" || voiceStatus == 6) && voiceUrl != "") { | ||
| 812 | var dom = document.getElementsByTagName("body")[0]; | ||
| 813 | var nDiv = document.createElement("div"); | ||
| 814 | nDiv.style.width = "0px"; | ||
| 815 | nDiv.style.height = "0px"; | ||
| 816 | nDiv.style.position = "absolute"; | ||
| 817 | var sound = document.createElement("audio"); | ||
| 818 | sound.src = voiceUrl; | ||
| 819 | //sound.preload= "preload"; | ||
| 820 | //sound.src = src; | ||
| 821 | nDiv.appendChild(sound); | ||
| 822 | dom.appendChild(nDiv); | ||
| 823 | sound.addEventListener("ended", function () { | ||
| 824 | if (typeof callback === "function") callback(true, null); | ||
| 825 | }, false); | ||
| 826 | sound.play(); | ||
| 827 | } else if (serverId != "") { | ||
| 828 | as.downloadVoice(serverId, function (res) { | ||
| 829 | as.playRecord(res, function () { | ||
| 830 | if (typeof callback == "function") callback(true, res); | ||
| 831 | }); | ||
| 832 | }); | ||
| 833 | } else { | ||
| 834 | if (typeof callback === "function") callback(false, null); | ||
| 835 | } | ||
| 836 | }; | ||
| 837 | //播放录音(微信) | ||
| 838 | as.playRecord = function (localId, callback) { | ||
| 839 | if (typeof wx != "undefined" && wx != void 0 && localId != "") { | ||
| 840 | wx.playVoice({ | ||
| 841 | localId: localId // 需要播放的音频的本地ID,由stopRecord接口获得 | ||
| 842 | }); | ||
| 843 | |||
| 844 | wx.onVoicePlayEnd({ | ||
| 845 | success: function (res) { | ||
| 846 | if (typeof callback === "function") callback(true); | ||
| 847 | } | ||
| 848 | }); | ||
| 849 | } else { | ||
| 850 | if (typeof callback === "function") callback(false); | ||
| 851 | } | ||
| 852 | }; | ||
| 853 | //停止播放录音(微信) | ||
| 854 | as.stopVoice = function (localId) { | ||
| 855 | if (typeof wx != "undefined" && wx != void 0 && localId != "") { | ||
| 856 | wx.stopVoice({ | ||
| 857 | localId: localId | ||
| 858 | }); | ||
| 859 | } | ||
| 860 | }; | ||
| 861 | /*------------------微信语音 end---------------------*/ | ||
| 862 | |||
| 863 | /*------------------其它 start---------------------*/ | ||
| 864 | /* | ||
| 865 | * tableName 要存的表的名字 | ||
| 866 | * data 为字典结构 | ||
| 867 | * 例如 data = {} | ||
| 868 | * data["key"] = value; | ||
| 869 | */ | ||
| 870 | as.saveTable = function (tableName, value, callback) { | ||
| 871 | var table = HDP.getTable(tableName); | ||
| 872 | for (var key in value) { | ||
| 873 | table.set(key, value[key]); | ||
| 874 | } | ||
| 875 | table.save({ | ||
| 876 | "success": function (res) { | ||
| 877 | if (typeof callback == "function") callback(res); | ||
| 878 | }, | ||
| 879 | "error": function (res) { | ||
| 880 | if (typeof callback == "function") callback(null); | ||
| 881 | } | ||
| 882 | }); | ||
| 883 | }; | ||
| 884 | /*------------------其它 end-----------------------*/ | ||
| 885 | |||
| 886 | /*------------------ 以下为定制化接口 ---------------------*/ | ||
| 887 | as.bizInterface = null; | ||
| 888 | //多奖池抽奖 | ||
| 889 | as.bizManyLottery = function (appId, callback) { | ||
| 890 | if (as.bizInterface == null) { | ||
| 891 | as.bizInterface = HDP.getBizInterface(); | ||
| 892 | } | ||
| 893 | |||
| 894 | if (appId == undefined || appId == null || appId == "") { | ||
| 895 | if (typeof callback == "function") callback({ | ||
| 896 | "result": false | ||
| 897 | }); | ||
| 898 | } | ||
| 899 | |||
| 900 | as.bizInterface.manyLottery({ | ||
| 901 | "param": { | ||
| 902 | "appId": appId | ||
| 903 | }, | ||
| 904 | "success": function (res) { | ||
| 905 | if (res && res.success && res.content) { | ||
| 906 | if (typeof callback == "function") callback(res.content); | ||
| 907 | } else { | ||
| 908 | if (typeof callback == "function") callback({ | ||
| 909 | "result": false | ||
| 910 | }); | ||
| 911 | } | ||
| 912 | }, | ||
| 913 | "error": function (res) { | ||
| 914 | if (typeof callback == "function") callback({ | ||
| 915 | "result": false | ||
| 916 | }); | ||
| 917 | } | ||
| 918 | }); | ||
| 919 | }; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
public/js/global-params.js
0 → 100644
| 1 | let global_gzh_name = "袋鼠妈妈学堂"; | ||
| 2 | let global_gzh_wxAppId = "wxaf7d9b7414c6df11"; | ||
| 3 | let global_register_redirect = false; | ||
| 4 | |||
| 5 | // let global_gzh_name = "安敏健行"; | ||
| 6 | // let global_gzh_wxAppId = "wx3a4821f58cc1ded7"; | ||
| 7 | // let global_register_redirect = "https://nutwpgateway.novaetech.cn/wx/oauth2/authorize?brandId=17378876&scope=snsapi_base&url=http%3A%2F%2Fh5.novaetech.cn%2F%23%2Fshowqrcode"; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
public/js/hdp-4.4.0.min.js
0 → 100644
This diff could not be displayed because it is too large.
public/js/jweixin-1.1.0.js
0 → 100644
| 1 | !function(e,n){"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n(e)}):n(e,!0)}(this,function(e,n){function i(n,i,t){e.WeixinJSBridge?WeixinJSBridge.invoke(n,o(i),function(e){c(n,e,t)}):u(n,t)}function t(n,i,t){e.WeixinJSBridge?WeixinJSBridge.on(n,function(e){t&&t.trigger&&t.trigger(e),c(n,e,i)}):t?u(n,t):u(n,i)}function o(e){return e=e||{},e.appId=P.appId,e.verifyAppId=P.appId,e.verifySignType="sha1",e.verifyTimestamp=P.timestamp+"",e.verifyNonceStr=P.nonceStr,e.verifySignature=P.signature,e}function r(e){return{timeStamp:e.timestamp+"",nonceStr:e.nonceStr,package:e.package,paySign:e.paySign,signType:e.signType||"SHA1"}}function a(e){return e.postalCode=e.addressPostalCode,delete e.addressPostalCode,e.provinceName=e.proviceFirstStageName,delete e.proviceFirstStageName,e.cityName=e.addressCitySecondStageName,delete e.addressCitySecondStageName,e.countryName=e.addressCountiesThirdStageName,delete e.addressCountiesThirdStageName,e.detailInfo=e.addressDetailInfo,delete e.addressDetailInfo,e}function c(e,n,i){"openEnterpriseChat"==e&&(n.errCode=n.err_code),delete n.err_code,delete n.err_desc,delete n.err_detail;var t=n.errMsg;t||(t=n.err_msg,delete n.err_msg,t=s(e,t),n.errMsg=t),(i=i||{})._complete&&(i._complete(n),delete i._complete),t=n.errMsg||"",P.debug&&!i.isInnerInvoke&&alert(JSON.stringify(n));var o=t.indexOf(":");switch(t.substring(o+1)){case"ok":i.success&&i.success(n);break;case"cancel":i.cancel&&i.cancel(n);break;default:i.fail&&i.fail(n)}i.complete&&i.complete(n)}function s(e,n){var i=e,t=h[i];t&&(i=t);var o="ok";if(n){var r=n.indexOf(":");"confirm"==(o=n.substring(r+1))&&(o="ok"),"failed"==o&&(o="fail"),-1!=o.indexOf("failed_")&&(o=o.substring(7)),-1!=o.indexOf("fail_")&&(o=o.substring(5)),"access denied"!=(o=(o=o.replace(/_/g," ")).toLowerCase())&&"no permission to execute"!=o||(o="permission denied"),"config"==i&&"function not exist"==o&&(o="ok"),""==o&&(o="fail")}return n=i+":"+o}function d(e){if(e){for(var n=0,i=e.length;n<i;++n){var t=e[n],o=g[t];o&&(e[n]=o)}return e}}function u(e,n){if(!(!P.debug||n&&n.isInnerInvoke)){var i=h[e];i&&(e=i),n&&n._complete&&delete n._complete,console.log('"'+e+'",',n||"")}}function l(e){if(!(I||T||P.debug||C<"6.0.2"||x.systemType<0)){var n=new Image;x.appId=P.appId,x.initTime=V.initEndTime-V.initStartTime,x.preVerifyTime=V.preVerifyEndTime-V.preVerifyStartTime,b.getNetworkType({isInnerInvoke:!0,success:function(e){x.networkType=e.networkType;var i="https://open.weixin.qq.com/sdk/report?v="+x.version+"&o="+x.isPreVerifyOk+"&s="+x.systemType+"&c="+x.clientVersion+"&a="+x.appId+"&n="+x.networkType+"&i="+x.initTime+"&p="+x.preVerifyTime+"&u="+x.url;n.src=i}})}}function p(){return(new Date).getTime()}function f(n){w&&(e.WeixinJSBridge?n():S.addEventListener&&S.addEventListener("WeixinJSBridgeReady",n,!1))}function m(){b.invoke||(b.invoke=function(n,i,t){e.WeixinJSBridge&&WeixinJSBridge.invoke(n,o(i),t)},b.on=function(n,i){e.WeixinJSBridge&&WeixinJSBridge.on(n,i)})}if(!e.jWeixin){var g={config:"preVerifyJSAPI",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress"},h=function(){var e={};for(var n in g)e[g[n]]=n;return e}(),S=e.document,y=S.title,v=navigator.userAgent.toLowerCase(),_=navigator.platform.toLowerCase(),I=!(!_.match("mac")&&!_.match("win")),T=-1!=v.indexOf("wxdebugger"),w=-1!=v.indexOf("micromessenger"),k=-1!=v.indexOf("android"),M=-1!=v.indexOf("iphone")||-1!=v.indexOf("ipad"),C=function(){var e=v.match(/micromessenger\/(\d+\.\d+\.\d+)/)||v.match(/micromessenger\/(\d+\.\d+)/);return e?e[1]:""}(),V={initStartTime:p(),initEndTime:0,preVerifyStartTime:0,preVerifyEndTime:0},x={version:1,appId:"",initTime:0,preVerifyTime:0,networkType:"",isPreVerifyOk:1,systemType:M?1:k?2:-1,clientVersion:C,url:encodeURIComponent(location.href)},P={},A={_completes:[]},B={state:0,data:{}};f(function(){V.initEndTime=p()});var b={config:function(e){P=e,u("config",e);var n=!1!==P.check;f(function(){if(n)i(g.config,{verifyJsApiList:d(P.jsApiList)},function(){A._complete=function(e){V.preVerifyEndTime=p(),B.state=1,B.data=e},A.success=function(e){x.isPreVerifyOk=0},A.fail=function(e){A._fail?A._fail(e):B.state=-1};var e=A._completes;return e.push(function(){l()}),A.complete=function(n){for(var i=0,t=e.length;i<t;++i)e[i]();A._completes=[]},A}()),V.preVerifyStartTime=p();else{B.state=1;for(var e=A._completes,t=0,o=e.length;t<o;++t)e[t]();A._completes=[]}}),P.beta&&m()},ready:function(e){0!=B.state?e():(A._completes.push(e),!w&&P.debug&&e())},error:function(e){C<"6.0.2"||(-1==B.state?e(B.data):A._fail=e)},checkJsApi:function(e){var n=function(e){var n=e.checkResult;for(var i in n){var t=h[i];t&&(n[t]=n[i],delete n[i])}return e};i("checkJsApi",{jsApiList:d(e.jsApiList)},(e._complete=function(e){if(k){var i=e.checkResult;i&&(e.checkResult=JSON.parse(i))}e=n(e)},e))},onMenuShareTimeline:function(e){t(g.onMenuShareTimeline,{complete:function(){i("shareTimeline",{title:e.title||y,desc:e.title||y,img_url:e.imgUrl||"",link:e.link||location.href,type:e.type||"link",data_url:e.dataUrl||""},e)}},e)},onMenuShareAppMessage:function(e){t(g.onMenuShareAppMessage,{complete:function(n){"favorite"===n.scene?i("sendAppMessage",{title:e.title||y,desc:e.desc||"",link:e.link||location.href,img_url:e.imgUrl||"",type:e.type||"link",data_url:e.dataUrl||""}):i("sendAppMessage",{title:e.title||y,desc:e.desc||"",link:e.link||location.href,img_url:e.imgUrl||"",type:e.type||"link",data_url:e.dataUrl||""},e)}},e)},onMenuShareQQ:function(e){t(g.onMenuShareQQ,{complete:function(){i("shareQQ",{title:e.title||y,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},onMenuShareWeibo:function(e){t(g.onMenuShareWeibo,{complete:function(){i("shareWeiboApp",{title:e.title||y,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},onMenuShareQZone:function(e){t(g.onMenuShareQZone,{complete:function(){i("shareQZone",{title:e.title||y,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},startRecord:function(e){i("startRecord",{},e)},stopRecord:function(e){i("stopRecord",{},e)},onVoiceRecordEnd:function(e){t("onVoiceRecordEnd",e)},playVoice:function(e){i("playVoice",{localId:e.localId},e)},pauseVoice:function(e){i("pauseVoice",{localId:e.localId},e)},stopVoice:function(e){i("stopVoice",{localId:e.localId},e)},onVoicePlayEnd:function(e){t("onVoicePlayEnd",e)},uploadVoice:function(e){i("uploadVoice",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},downloadVoice:function(e){i("downloadVoice",{serverId:e.serverId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},translateVoice:function(e){i("translateVoice",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},chooseImage:function(e){i("chooseImage",{scene:"1|2",count:e.count||9,sizeType:e.sizeType||["original","compressed"],sourceType:e.sourceType||["album","camera"]},(e._complete=function(e){if(k){var n=e.localIds;try{n&&(e.localIds=JSON.parse(n))}catch(e){}}},e))},previewImage:function(e){i(g.previewImage,{current:e.current,urls:e.urls},e)},uploadImage:function(e){i("uploadImage",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},downloadImage:function(e){i("downloadImage",{serverId:e.serverId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},getNetworkType:function(e){var n=function(e){var n=e.errMsg;e.errMsg="getNetworkType:ok";var i=e.subtype;if(delete e.subtype,i)e.networkType=i;else{var t=n.indexOf(":"),o=n.substring(t+1);switch(o){case"wifi":case"edge":case"wwan":e.networkType=o;break;default:e.errMsg="getNetworkType:fail"}}return e};i("getNetworkType",{},(e._complete=function(e){e=n(e)},e))},openLocation:function(e){i("openLocation",{latitude:e.latitude,longitude:e.longitude,name:e.name||"",address:e.address||"",scale:e.scale||28,infoUrl:e.infoUrl||""},e)},getLocation:function(e){e=e||{},i(g.getLocation,{type:e.type||"wgs84"},(e._complete=function(e){delete e.type},e))},hideOptionMenu:function(e){i("hideOptionMenu",{},e)},showOptionMenu:function(e){i("showOptionMenu",{},e)},closeWindow:function(e){i("closeWindow",{},e=e||{})},hideMenuItems:function(e){i("hideMenuItems",{menuList:e.menuList},e)},showMenuItems:function(e){i("showMenuItems",{menuList:e.menuList},e)},hideAllNonBaseMenuItem:function(e){i("hideAllNonBaseMenuItem",{},e)},showAllNonBaseMenuItem:function(e){i("showAllNonBaseMenuItem",{},e)},scanQRCode:function(e){i("scanQRCode",{needResult:(e=e||{}).needResult||0,scanType:e.scanType||["qrCode","barCode"]},(e._complete=function(e){if(M){var n=e.resultStr;if(n){var i=JSON.parse(n);e.resultStr=i&&i.scan_code&&i.scan_code.scan_result}}},e))},openAddress:function(e){i(g.openAddress,{},(e._complete=function(e){e=a(e)},e))},openProductSpecificView:function(e){i(g.openProductSpecificView,{pid:e.productId,view_type:e.viewType||0,ext_info:e.extInfo},e)},addCard:function(e){for(var n=e.cardList,t=[],o=0,r=n.length;o<r;++o){var a=n[o],c={card_id:a.cardId,card_ext:a.cardExt};t.push(c)}i(g.addCard,{card_list:t},(e._complete=function(e){var n=e.card_list;if(n){for(var i=0,t=(n=JSON.parse(n)).length;i<t;++i){var o=n[i];o.cardId=o.card_id,o.cardExt=o.card_ext,o.isSuccess=!!o.is_succ,delete o.card_id,delete o.card_ext,delete o.is_succ}e.cardList=n,delete e.card_list}},e))},chooseCard:function(e){i("chooseCard",{app_id:P.appId,location_id:e.shopId||"",sign_type:e.signType||"SHA1",card_id:e.cardId||"",card_type:e.cardType||"",card_sign:e.cardSign,time_stamp:e.timestamp+"",nonce_str:e.nonceStr},(e._complete=function(e){e.cardList=e.choose_card_info,delete e.choose_card_info},e))},openCard:function(e){for(var n=e.cardList,t=[],o=0,r=n.length;o<r;++o){var a=n[o],c={card_id:a.cardId,code:a.code};t.push(c)}i(g.openCard,{card_list:t},e)},consumeAndShareCard:function(e){i(g.consumeAndShareCard,{consumedCardId:e.cardId,consumedCode:e.code},e)},chooseWXPay:function(e){i(g.chooseWXPay,r(e),e)},openEnterpriseRedPacket:function(e){i(g.openEnterpriseRedPacket,r(e),e)},startSearchBeacons:function(e){i(g.startSearchBeacons,{ticket:e.ticket},e)},stopSearchBeacons:function(e){i(g.stopSearchBeacons,{},e)},onSearchBeacons:function(e){t(g.onSearchBeacons,e)},openEnterpriseChat:function(e){i("openEnterpriseChat",{useridlist:e.userIds,chatname:e.groupName},e)}};return n&&(e.wx=e.jWeixin=b),b}}); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -6,10 +6,6 @@ import Router from '../router' | ... | @@ -6,10 +6,6 @@ import Router from '../router' |
| 6 | // Toast | 6 | // Toast |
| 7 | // } from 'vant'; | 7 | // } from 'vant'; |
| 8 | 8 | ||
| 9 | function Toast(msg) { | ||
| 10 | console.log("msg:", msg); | ||
| 11 | } | ||
| 12 | |||
| 13 | // axios的默认url | 9 | // axios的默认url |
| 14 | // axios.defaults.baseURL = "" | 10 | // axios.defaults.baseURL = "" |
| 15 | 11 | ||
| ... | @@ -192,21 +188,21 @@ export const formdata = params => { | ... | @@ -192,21 +188,21 @@ export const formdata = params => { |
| 192 | 188 | ||
| 193 | export const request = { | 189 | export const request = { |
| 194 | post(url, data) { | 190 | post(url, data) { |
| 195 | return axios.post(`${requestDomain}${url}`, data); | 191 | return axios.post(`${base}${url}`, data); |
| 196 | }, | 192 | }, |
| 197 | get(url, data) { | 193 | get(url, data) { |
| 198 | return axios.get(`${requestDomain}${url}`, { params: data }); | 194 | return axios.get(`${base}${url}`, { params: data }); |
| 199 | }, | 195 | }, |
| 200 | form(url, params) { | 196 | form(url, params) { |
| 201 | let formData = new FormData(); //使用formData对象 | 197 | let formData = new FormData(); //使用formData对象 |
| 202 | for (let key in params) { | 198 | for (let key in params) { |
| 203 | formData.append(key, params[key]); | 199 | formData.append(key, params[key]); |
| 204 | } | 200 | } |
| 205 | let requestUrl = url.indexOf("://") >= 0 ? `${url}` : `${requestDomain}${url}`; | 201 | let requestUrl = url.indexOf("://") >= 0 ? `${url}` : `${base}${url}`; |
| 206 | return axios.post(requestUrl, formData, formDataHeaders) | 202 | return axios.post(requestUrl, formData, formDataHeaders) |
| 207 | }, | 203 | }, |
| 208 | build(url, params){ | 204 | build(url, params){ |
| 209 | let fullUrl = `${requestDomain}${url}`; | 205 | let fullUrl = `${base}${url}`; |
| 210 | let split = ""; | 206 | let split = ""; |
| 211 | for(let key in params){ | 207 | for(let key in params){ |
| 212 | if(split){ | 208 | if(split){ | ... | ... |
src/assets/imgs/model-bottom.png
0 → 100644
79.8 KB
src/assets/imgs/model-close.png
0 → 100644
1.59 KB
src/assets/imgs/model-share-tip.png
0 → 100644
51 KB
| 1 | <template> | 1 | <template> |
| 2 | <van-overlay :show="show" > | 2 | <van-popup v-model="data.show"> |
| 3 | <div class="model"> | ||
| 4 | <div class="model-close" @click="modelCloseHandler"></div> | ||
| 5 | <div class="model-content"> | ||
| 6 | <div class="model-head-line"></div> | ||
| 7 | <div class="model-title">{{data.title}}</div> | ||
| 3 | 8 | ||
| 4 | </van-overlay> | 9 | <div class="successModel" v-if="data.index == 'default'"> |
| 10 | <div class="model-data">{{data.content}}</div> | ||
| 11 | <div v-if="data.btnShow" class="sys-btn-02" @click="modelBtnClickHandler">{{data.btnText}}</div> | ||
| 12 | <div | ||
| 13 | v-if="data.labelBtnShow" | ||
| 14 | class="label-btn" | ||
| 15 | @click="labelBtnClickHandler" | ||
| 16 | >{{data.labelBtnText}}</div> | ||
| 17 | <div class="model-bottom-line"></div> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | </div> | ||
| 21 | </van-popup> | ||
| 5 | </template> | 22 | </template> |
| 6 | 23 | ||
| 7 | <script> | 24 | <script> |
| 8 | import Vue from "vue"; | 25 | import Vue from "vue"; |
| 9 | import { Overlay } from "vant"; | 26 | import { Popup } from "vant"; |
| 10 | Vue.use(Overlay); | 27 | Vue.use(Popup); |
| 11 | 28 | ||
| 12 | export default { | 29 | export default { |
| 13 | props: ["value"], | 30 | props: ["value"], |
| 14 | data() { | 31 | data() { |
| 15 | return { | 32 | return { |
| 16 | model: this.value, | 33 | data: this.value |
| 17 | show: false | ||
| 18 | }; | 34 | }; |
| 19 | }, | 35 | }, |
| 20 | methods: {}, | 36 | methods: { |
| 21 | created() {} | 37 | modelCloseHandler() { |
| 38 | this.$emit("close"); | ||
| 39 | this.data.show = false; | ||
| 40 | }, | ||
| 41 | modelBtnClickHandler() { | ||
| 42 | this.data.show = false; | ||
| 43 | typeof this.data.confirmHandler == "function" && | ||
| 44 | this.data.confirmHandler(); | ||
| 45 | }, | ||
| 46 | labelBtnClickHandler() { | ||
| 47 | this.data.show = false; | ||
| 48 | typeof this.data.labelBtnHandler == "function" && | ||
| 49 | this.data.labelBtnHandler(); | ||
| 50 | } | ||
| 51 | }, | ||
| 52 | created() { | ||
| 53 | this.data = this.data | ||
| 54 | ? this.data | ||
| 55 | : { | ||
| 56 | title: "", | ||
| 57 | description: "", | ||
| 58 | show: false, | ||
| 59 | index: "default", | ||
| 60 | btnShow: false, | ||
| 61 | btnText: "", | ||
| 62 | confirmHandler: null, | ||
| 63 | labelBtnShow: false, | ||
| 64 | labelBtnText: "", | ||
| 65 | labelBtnHandler: null | ||
| 66 | }; | ||
| 67 | } | ||
| 22 | }; | 68 | }; |
| 23 | </script> | 69 | </script> |
| 24 | 70 | ||
| 25 | <style lang="less" scoped> | 71 | <style lang="less" scoped> |
| 72 | .van-popup { | ||
| 73 | background-color: transparent; | ||
| 74 | top: 40%; | ||
| 75 | } | ||
| 76 | .model { | ||
| 77 | display: flex; | ||
| 78 | width: 480px; | ||
| 79 | min-height: 576px; | ||
| 80 | flex-direction: column; | ||
| 81 | align-items: flex-end; | ||
| 82 | } | ||
| 83 | |||
| 84 | .model-head-line { | ||
| 85 | height: 50px; | ||
| 86 | background-color: transparent; | ||
| 87 | } | ||
| 88 | .model-bottom-line { | ||
| 89 | height: 50px; | ||
| 90 | background-color: transparent; | ||
| 91 | } | ||
| 92 | |||
| 93 | .model-close { | ||
| 94 | width: 64px; | ||
| 95 | height: 116px; | ||
| 96 | background: url(../../assets/imgs/model-close.png); | ||
| 97 | background-size: 100%; | ||
| 98 | } | ||
| 99 | |||
| 100 | .model-content { | ||
| 101 | width: 480px; | ||
| 102 | min-height: 460px; | ||
| 103 | height: auto; | ||
| 104 | background: url(../../assets/imgs/model-bottom.png) no-repeat; | ||
| 105 | background-size: 100% auto; | ||
| 106 | background-position: bottom; | ||
| 107 | border-radius: 30px; | ||
| 108 | background-color: #fff; | ||
| 109 | } | ||
| 110 | |||
| 111 | .model-title { | ||
| 112 | font-size: 45px; | ||
| 113 | font-weight: bold; | ||
| 114 | } | ||
| 115 | |||
| 116 | .model-data { | ||
| 117 | font-size: 30px; | ||
| 118 | margin: 50px auto 70px auto; | ||
| 119 | width: 400px; | ||
| 120 | text-align: center; | ||
| 121 | } | ||
| 122 | |||
| 123 | .sys-btn-02 { | ||
| 124 | width: 300px; | ||
| 125 | font-size: 30px; | ||
| 126 | line-height: 80px; | ||
| 127 | } | ||
| 128 | |||
| 129 | .label-btn { | ||
| 130 | font-size: 26px; | ||
| 131 | text-align: center; | ||
| 132 | } | ||
| 26 | </style> | 133 | </style> | ... | ... |
| ... | @@ -56,11 +56,15 @@ export default { | ... | @@ -56,11 +56,15 @@ export default { |
| 56 | }, | 56 | }, |
| 57 | login() { | 57 | login() { |
| 58 | httpPost({ url: urls.login, data: this.loginParam }).then(res => { | 58 | httpPost({ url: urls.login, data: this.loginParam }).then(res => { |
| 59 | if (!res.sessionId) { | ||
| 60 | store.toWxLogin(); | ||
| 61 | } else { | ||
| 59 | store.putSession(res.sessionId); | 62 | store.putSession(res.sessionId); |
| 60 | let path = store.getRedirectUrl(); | 63 | let path = store.getRedirectUrl(); |
| 61 | path = !path ? "/index" : path; | 64 | path = !path ? "/index" : path; |
| 62 | store.delRedirectUrl(); | 65 | store.delRedirectUrl(); |
| 63 | this.$router.push(path); | 66 | this.$router.push(path); |
| 67 | } | ||
| 64 | }); | 68 | }); |
| 65 | } | 69 | } |
| 66 | }, | 70 | }, | ... | ... |
| ... | @@ -185,6 +185,8 @@ export default { | ... | @@ -185,6 +185,8 @@ export default { |
| 185 | }); | 185 | }); |
| 186 | httpPost({ url: urls.submit, data: this.formData }).then(res => { | 186 | httpPost({ url: urls.submit, data: this.formData }).then(res => { |
| 187 | Toast.clear(); | 187 | Toast.clear(); |
| 188 | this.formData.worksCode = res; | ||
| 189 | console.log("submit === =", res); | ||
| 188 | this.$emit("submit", res); | 190 | this.$emit("submit", res); |
| 189 | }); | 191 | }); |
| 190 | } | 192 | } |
| ... | @@ -314,7 +316,6 @@ export default { | ... | @@ -314,7 +316,6 @@ export default { |
| 314 | color: #4f9984; | 316 | color: #4f9984; |
| 315 | font-size: 18px; | 317 | font-size: 18px; |
| 316 | } | 318 | } |
| 317 | |||
| 318 | } | 319 | } |
| 319 | 320 | ||
| 320 | .view-btn-group { | 321 | .view-btn-group { | ... | ... |
| ... | @@ -57,15 +57,17 @@ | ... | @@ -57,15 +57,17 @@ |
| 57 | </template> | 57 | </template> |
| 58 | 58 | ||
| 59 | <script> | 59 | <script> |
| 60 | let urls = {}; | 60 | let urls = { |
| 61 | praise: "/jiajiaCHApi/app/works/praise" | ||
| 62 | }; | ||
| 61 | 63 | ||
| 62 | import { httpGet, httpPost } from "@/api/fetch-api"; | 64 | import { request } from "@/api/fetch-api"; |
| 63 | 65 | ||
| 64 | import Vue from "vue"; | 66 | import Vue from "vue"; |
| 65 | import { Toast } from "vant"; | 67 | import { Toast } from "vant"; |
| 66 | import { Popup } from "vant"; | 68 | import { Swipe, SwipeItem } from "vant"; |
| 67 | 69 | ||
| 68 | Vue.use(Popup); | 70 | Vue.use(Swipe).use(SwipeItem); |
| 69 | Vue.use(Toast); | 71 | Vue.use(Toast); |
| 70 | 72 | ||
| 71 | export default { | 73 | export default { |
| ... | @@ -81,9 +83,28 @@ export default { | ... | @@ -81,9 +83,28 @@ export default { |
| 81 | }, | 83 | }, |
| 82 | selfPraiseHandler() { | 84 | selfPraiseHandler() { |
| 83 | // 自己点赞 | 85 | // 自己点赞 |
| 86 | let data = { | ||
| 87 | worksCode: this.formData.worksCode | ||
| 88 | }; | ||
| 89 | Toast.loading({ | ||
| 90 | mask: true, | ||
| 91 | message: "数据提交..." | ||
| 92 | }); | ||
| 93 | request | ||
| 94 | .post(urls.praise, data) | ||
| 95 | .then(res => { | ||
| 96 | Toast.clear(); | ||
| 97 | this.$emit("praiseSuccess") | ||
| 98 | }) | ||
| 99 | .catch(res => { | ||
| 100 | let msg = res.data.errMsg; | ||
| 101 | Toast(msg); | ||
| 102 | }); | ||
| 84 | }, | 103 | }, |
| 85 | showShareHandler() { | 104 | showShareHandler() { |
| 86 | // 出现分享层 | 105 | // 出现分享层 |
| 106 | this.$emit("showShare") | ||
| 107 | console.log("show share") | ||
| 87 | } | 108 | } |
| 88 | }, | 109 | }, |
| 89 | created() { | 110 | created() { | ... | ... |
| ... | @@ -2,16 +2,26 @@ | ... | @@ -2,16 +2,26 @@ |
| 2 | <div class="home"> | 2 | <div class="home"> |
| 3 | <div class="head-leap"></div> | 3 | <div class="head-leap"></div> |
| 4 | 4 | ||
| 5 | <ViewModel v-model="formData" v-if="init && !formEdit" v-on:edit="formEdit=true"></ViewModel> | 5 | <ViewModel |
| 6 | <EditModel v-model="formData" v-if="init && formEdit" v-on:submit="initActivity"></EditModel> | 6 | v-model="formData" |
| 7 | v-if="init && !formEdit" | ||
| 8 | v-on:edit="formEdit=true" | ||
| 9 | v-on:praiseSuccess="showPraiseSuccessModel" | ||
| 10 | v-on:showShare="shareModelVisiable=true" | ||
| 11 | ></ViewModel> | ||
| 12 | <EditModel v-model="formData" v-if="init && formEdit" v-on:submit="showSuccessModel"></EditModel> | ||
| 7 | 13 | ||
| 8 | <div class="bottom-line"></div> | 14 | <div class="bottom-line"></div> |
| 9 | 15 | ||
| 10 | <bottom-tool v-model="activityIndex"></bottom-tool> | 16 | <bottom-tool v-model="activityIndex"></bottom-tool> |
| 11 | 17 | <biz-model v-model="model"></biz-model> | |
| 12 | <!-- <van-popup class="messagePopue" v-model="successModelVisiable" :close-on-click-overlay="false"> | 18 | <!-- 分享蒙层 --> |
| 13 | <div></div> | 19 | <div class="shareModel" v-if="shareModelVisiable" @click="shareModelVisiable = false"> |
| 14 | </van-popup>--> | 20 | <div class="shareModelContainer"> |
| 21 | <div class="shareModelMask"></div> | ||
| 22 | <div class="shareIcon"></div> | ||
| 23 | </div> | ||
| 24 | </div> | ||
| 15 | </div> | 25 | </div> |
| 16 | </template> | 26 | </template> |
| 17 | 27 | ||
| ... | @@ -22,6 +32,7 @@ let urls = { | ... | @@ -22,6 +32,7 @@ let urls = { |
| 22 | }; | 32 | }; |
| 23 | 33 | ||
| 24 | import BottomTool from "@/components/bottom-tools/bottom-tools"; | 34 | import BottomTool from "@/components/bottom-tools/bottom-tools"; |
| 35 | import BizModel from "@/components/biz-model/biz-model"; | ||
| 25 | import EditModel from "./components/EditModel"; | 36 | import EditModel from "./components/EditModel"; |
| 26 | import ViewModel from "./components/ViewModel"; | 37 | import ViewModel from "./components/ViewModel"; |
| 27 | 38 | ||
| ... | @@ -30,14 +41,8 @@ import AreaList from "@/api/area"; | ... | @@ -30,14 +41,8 @@ import AreaList from "@/api/area"; |
| 30 | 41 | ||
| 31 | import Vue from "vue"; | 42 | import Vue from "vue"; |
| 32 | import { Toast } from "vant"; | 43 | import { Toast } from "vant"; |
| 33 | import { Area } from "vant"; | ||
| 34 | import { Popup } from "vant"; | ||
| 35 | import { Swipe, SwipeItem } from "vant"; | ||
| 36 | 44 | ||
| 37 | Vue.use(Popup); | ||
| 38 | Vue.use(Area); | ||
| 39 | Vue.use(Toast); | 45 | Vue.use(Toast); |
| 40 | Vue.use(Swipe).use(SwipeItem); | ||
| 41 | 46 | ||
| 42 | export default { | 47 | export default { |
| 43 | name: "home", | 48 | name: "home", |
| ... | @@ -47,8 +52,9 @@ export default { | ... | @@ -47,8 +52,9 @@ export default { |
| 47 | formEdit: false, | 52 | formEdit: false, |
| 48 | init: false, | 53 | init: false, |
| 49 | isMy: 1, | 54 | isMy: 1, |
| 50 | successModelVisiable: true, | 55 | shareModelVisiable: false, |
| 51 | formData: { | 56 | formData: { |
| 57 | worksCode: "", | ||
| 52 | name: "", | 58 | name: "", |
| 53 | province: "", | 59 | province: "", |
| 54 | provinceCode: "", | 60 | provinceCode: "", |
| ... | @@ -59,6 +65,18 @@ export default { | ... | @@ -59,6 +65,18 @@ export default { |
| 59 | parentName: "", | 65 | parentName: "", |
| 60 | parentMobile: "", | 66 | parentMobile: "", |
| 61 | worksList: [] | 67 | worksList: [] |
| 68 | }, | ||
| 69 | model: { | ||
| 70 | show: false, | ||
| 71 | title: "", | ||
| 72 | content: "", | ||
| 73 | index: "default", | ||
| 74 | btnShow: false, | ||
| 75 | btnText: "", | ||
| 76 | confirmHandler: null, | ||
| 77 | labelBtnShow: false, | ||
| 78 | labelBtnText: "", | ||
| 79 | labelBtnHandler: null | ||
| 62 | } | 80 | } |
| 63 | }; | 81 | }; |
| 64 | }, | 82 | }, |
| ... | @@ -78,13 +96,57 @@ export default { | ... | @@ -78,13 +96,57 @@ export default { |
| 78 | } else { | 96 | } else { |
| 79 | this.formEdit = false; | 97 | this.formEdit = false; |
| 80 | } | 98 | } |
| 99 | this.initShare(); | ||
| 81 | }); | 100 | }); |
| 101 | }, | ||
| 102 | showSuccessModel() { | ||
| 103 | this.model.title = "温馨提示"; | ||
| 104 | this.model.content = "报名已成功!"; | ||
| 105 | this.model.index = "default"; | ||
| 106 | this.model.btnShow = true; | ||
| 107 | this.model.btnText = "查看我的主页"; | ||
| 108 | this.model.show = true; | ||
| 109 | |||
| 110 | let that = this; | ||
| 111 | this.model.confirmHandler = function() { | ||
| 112 | that.initActivity(); | ||
| 113 | }; | ||
| 114 | }, | ||
| 115 | showPraiseSuccessModel() { | ||
| 116 | this.model.show = true; | ||
| 117 | this.model.title = "点赞成功"; | ||
| 118 | this.model.content = "您已获得一次抽奖机会"; | ||
| 119 | this.model.btnShow = true; | ||
| 120 | this.model.btnText = "前往抽奖"; | ||
| 121 | |||
| 122 | let that = this; | ||
| 123 | this.model.confirmHandler = function() { | ||
| 124 | that.$router.push("/draw"); | ||
| 125 | }; | ||
| 126 | this.model.labelBtnShow = true; | ||
| 127 | this.model.labelBtnText = "查看个人主页"; | ||
| 128 | this.model.labelBtnHandler = function() { | ||
| 129 | that.initActivity(); | ||
| 130 | }; | ||
| 131 | }, | ||
| 132 | initShare() { | ||
| 133 | let link = location.origin + location.pathname; | ||
| 134 | if (this.formData.worksCode) { | ||
| 135 | link += "?worksCode=" + this.formData.worksCode; | ||
| 136 | } | ||
| 137 | let desc = this.formData.profile || null; | ||
| 138 | let imgurl = | ||
| 139 | this.formData.worksList.length > 0 | ||
| 140 | ? this.formData.worksList[0].worksUrl | ||
| 141 | : null; | ||
| 142 | as.setShare(link, null, desc, imgurl); | ||
| 82 | } | 143 | } |
| 83 | }, | 144 | }, |
| 84 | components: { | 145 | components: { |
| 85 | BottomTool, | 146 | BottomTool, |
| 86 | EditModel, | 147 | EditModel, |
| 87 | ViewModel | 148 | ViewModel, |
| 149 | BizModel | ||
| 88 | }, | 150 | }, |
| 89 | created() { | 151 | created() { |
| 90 | this.initActivity(); | 152 | this.initActivity(); |
| ... | @@ -113,4 +175,37 @@ export default { | ... | @@ -113,4 +175,37 @@ export default { |
| 113 | height: 250px; | 175 | height: 250px; |
| 114 | background-color: transparent; | 176 | background-color: transparent; |
| 115 | } | 177 | } |
| 178 | |||
| 179 | .shareModel { | ||
| 180 | position: fixed; | ||
| 181 | height: 100%; | ||
| 182 | width: 100%; | ||
| 183 | left: 0px; | ||
| 184 | top: 0px; | ||
| 185 | z-index: 9999; | ||
| 186 | } | ||
| 187 | |||
| 188 | .shareModelContainer { | ||
| 189 | position: relative; | ||
| 190 | height: 100%; | ||
| 191 | width: 100%; | ||
| 192 | } | ||
| 193 | |||
| 194 | .shareModelMask { | ||
| 195 | position: absolute; | ||
| 196 | left: 0px; | ||
| 197 | top: 0px; | ||
| 198 | width: 100%; | ||
| 199 | height: 100%; | ||
| 200 | background-color: rgba(0, 0, 0, 0.7); | ||
| 201 | } | ||
| 202 | .shareIcon { | ||
| 203 | position: absolute; | ||
| 204 | top: 0px; | ||
| 205 | right: 30px; | ||
| 206 | width: 425px; | ||
| 207 | height: 220px; | ||
| 208 | background: url(../../assets/imgs/model-share-tip.png) no-repeat; | ||
| 209 | background-size: 100%; | ||
| 210 | } | ||
| 116 | </style> | 211 | </style> | ... | ... |
-
Please register or sign in to post a comment