Commit d8f0de6ca4bb73cbf92f82e5e214bf798f0d12d5
1 parent
306a4d47
Exists in
master
第一次测试反馈调整
1. 激活界面 a. "商品图片/视频" "发货地址" "商家留言" "手机号" 调整为可选项 b. "商品图片/视频" "发货地址" "商家留言" 如果填写了那手机号则必须要填写 c. 不填写"商品图片/视频" "发货地址" "商家留言" "手机号"信息可以激活二维码。 d. 需要支持上传视频 e. 可上传多张图片 2. 激活结果页面需要加倒计时读秒跳转,目前是静默读秒跳转 3.拍照时需要文案提示用户聚焦拍照。 4.扫码未激活的二维码,不应该跳转到验证标签页面,应该直接跳转到激活界面。 5.商品详情添加视频展示和图片展示
Showing
22 changed files
with
361 additions
and
95 deletions
Show diff stats
app-wx/controllers/QrcodeController.php
... | ... | @@ -78,7 +78,7 @@ class QrcodeController extends BaseController |
78 | 78 | */ |
79 | 79 | private function jumpActive($uuid) |
80 | 80 | { |
81 | - $jumpUrl = Yii::$app->params["baseUrl"] . "?jumpmodel=check&jumppath=warning/" . $uuid ; | |
81 | + $jumpUrl = Yii::$app->params["baseUrl"] . "?jumpmodel=smart&jumppath=enter/" . $uuid ; | |
82 | 82 | header("Location: $jumpUrl");exit; |
83 | 83 | } |
84 | 84 | } | ... | ... |
app-wx/modules/check/controllers/DefaultController.php
... | ... | @@ -190,9 +190,21 @@ class DefaultController extends BaseController |
190 | 190 | $e->message = '提取码错误!'; |
191 | 191 | return $this->renderJson($e); |
192 | 192 | } |
193 | - $hasRecord->product_image_path = ImageManager::getUrl($hasRecord->product_image_path); | |
193 | + $imageData = []; | |
194 | + if ($hasRecord->product_image_path) { | |
195 | + $imageData = json_decode($hasRecord->product_image_path, true); | |
196 | + foreach ($imageData as $key => $imageItem) { | |
197 | + if (isset($imageItem["path"]) && !empty($imageItem["path"])) { | |
198 | + $imageData[$key]["path"] = ImageManager::getUrl($imageItem["path"]); | |
199 | + } | |
200 | + } | |
201 | + } | |
202 | + $hasRecord->product_image_path = $imageData; | |
203 | + $hasRecord->product_vedio_path = (!empty($hasRecord->product_vedio_path)) ? ImageManager::getUrl($hasRecord->product_vedio_path) : ""; | |
204 | + $dataReturn = $hasRecord->toArray(); | |
205 | + $dataReturn["first_product_image_path"] = !empty($imageData) && isset($imageData[0]["path"]) ? $imageData[0]["path"] : ""; | |
194 | 206 | $e->success = true; |
195 | - $e->data = $hasRecord->toArray(); | |
207 | + $e->data = $dataReturn; | |
196 | 208 | $e->message = '获取成功!'; |
197 | 209 | return $this->renderJson($e); |
198 | 210 | } | ... | ... |
app-wx/modules/check/views/default/pages/info-template.php
... | ... | @@ -41,13 +41,38 @@ $baseUrl = Url::base(true); |
41 | 41 | color:rgba(106,106,106,1); |
42 | 42 | line-height:1.41rem; |
43 | 43 | } |
44 | + #info .image_button { | |
45 | + padding: 0.2rem 0.5rem;margin-right:0.5rem;color:#fff;background-color: #00BC70;border-radius: 1rem; | |
46 | + } | |
47 | + #info .vedio_button { | |
48 | + padding: 0.2rem 0.5rem;margin-right:0.5rem;color:#fff;background-color: #0d95d6;border-radius: 1rem; | |
49 | + } | |
44 | 50 | </style> |
45 | 51 | <script id="info-template" type="text/template"> |
46 | 52 | <div class="pages" id="info"> |
47 | 53 | <div class="page"> |
48 | 54 | <div class="page-content"> |
49 | 55 | <div class="scan-image-div"> |
50 | - <img src="{{#js_compare "this.product_image_path != ''"}}{{product_image_path}}{{else}}<?=$baseUrl?>/i/check/error.png{{/js_compare}}" class="scan-image"/> | |
56 | + {{#js_compare "this.first_product_image_path != ''"}} | |
57 | + <img src="{{first_product_image_path}}" class="scan-image"/> | |
58 | + {{else}} | |
59 | + {{#js_compare "this.product_vedio_path != ''"}} | |
60 | + <video class="scan-image" style="border: 1px solid #cce1f1;object-fit: fill;" alt="商品视频" controls="controls"> | |
61 | + <source src="{{product_vedio_path}}" type="video/mp4"> | |
62 | + 您的浏览器不支持 video 标签。 | |
63 | + </video> | |
64 | + {{else}} | |
65 | + <img src="<?=$baseUrl?>/i/check/logo.png" class="scan-image"/> | |
66 | + {{/js_compare}} | |
67 | + {{/js_compare}} | |
68 | + </div> | |
69 | + <div style="text-align:center;margin-top:0.5rem;margin-left:0.5rem"> | |
70 | + {{#each product_image_path}} | |
71 | + <span class="image_button" data-url="{{this.path}}">图{{@index+1}}</span> | |
72 | + {{/each}} | |
73 | + {{#js_compare "this.product_vedio_path != ''"}} | |
74 | + <span class="vedio_button" data-url="{{product_vedio_path}}">视频</span> | |
75 | + {{/js_compare}} | |
51 | 76 | </div> |
52 | 77 | <div class="scan-tip"> |
53 | 78 | <div class="title"> | ... | ... |
app-wx/modules/check/views/default/pages/warning-template.php
app-wx/modules/smart/controllers/DefaultController.php
... | ... | @@ -3,8 +3,10 @@ |
3 | 3 | namespace app\wx\modules\smart\controllers; |
4 | 4 | |
5 | 5 | use Yii; |
6 | +use common\helpers\Log; | |
6 | 7 | use common\helpers\CheckActiveHelper; |
7 | 8 | use common\helpers\ImageManager; |
9 | +use common\helpers\ImageUtils; | |
8 | 10 | use common\helpers\WxHelper; |
9 | 11 | use domain\smart\ScanRecords; |
10 | 12 | use domain\system\message\SmsMessage; |
... | ... | @@ -27,12 +29,96 @@ class DefaultController extends BaseController |
27 | 29 | } |
28 | 30 | |
29 | 31 | /** |
32 | + * @return string | |
33 | + */ | |
34 | + public function actionUploadImg() | |
35 | + { | |
36 | + $e = new stdClass(); | |
37 | + $e->success = false; | |
38 | + $e->message = 'ok'; | |
39 | + | |
40 | + if (empty($_FILES["file"])) { | |
41 | + $e->message = '文件为空!'; | |
42 | + return $this->renderJson($e); | |
43 | + } | |
44 | + if (empty($_FILES["file"]['tmp_name'])) { | |
45 | + $e->message = '文件太大上传不了'; | |
46 | + return $this->renderJson($e); | |
47 | + } | |
48 | + $type = $_FILES["file"]["type"]; | |
49 | + $typeArr = explode('/', $type); | |
50 | + if ('image' !== $typeArr[0] && 'video' !== $typeArr[0] && 'audio' !== $typeArr[0]) { | |
51 | + $e->message = '只能上传MP4视频和图片文件'; | |
52 | + return $this->renderJson($e); | |
53 | + } | |
54 | + $fileArr = explode('.', $_FILES["file"]['name']); | |
55 | + $fileExt = end($fileArr); | |
56 | + // 判断文件大小 | |
57 | + $fileSize = $_FILES["file"]["size"] / (1024 * 1024); | |
58 | + if (strtoupper($fileExt) == "MP4") { | |
59 | + if ($fileSize > 10) { | |
60 | + $e->message = 'MP4视频文件不能大于10M'; | |
61 | + return $this->renderJson($e); | |
62 | + } | |
63 | + } else { | |
64 | + if ($fileSize > 5) { | |
65 | + $e->message = '图片文件不能大于5M'; | |
66 | + return $this->renderJson($e); | |
67 | + } | |
68 | + } | |
69 | + | |
70 | + | |
71 | + $dir = Yii::getAlias('@app/wx') . "/web/tmp"; | |
72 | + | |
73 | + $tt = time(); | |
74 | + $filename = 'smart_'.$tt.md5($_FILES["file"]['name']) . '.' . $fileExt; | |
75 | + $saveFilePath = $dir.'/'.$filename; | |
76 | + move_uploaded_file($_FILES["file"]['tmp_name'], $saveFilePath); | |
77 | + $ossPath = ImageManager::getTempImgPath($fileExt); | |
78 | + ImageManager::add($saveFilePath, $ossPath); | |
79 | + if (strtoupper($fileExt) == "MP4") { | |
80 | + $tmpMinFile = $this->site->base_url. "/i/enter/vedio.jpg"; | |
81 | + } else { | |
82 | + $tmpMinFile = ImageManager::getUrl($ossPath, ImageManager::$STYLE_180); | |
83 | + } | |
84 | + Log::DEBUG("上传文件信息:" . json_encode($_FILES)); | |
85 | + // 删除ECS服务器文件 | |
86 | + @unlink($saveFilePath); | |
87 | + // 上传到OSS | |
88 | + $e->success = true; | |
89 | + $e->tmpFile = $ossPath; | |
90 | + $e->tmpMinUrl = $tmpMinFile; | |
91 | + $e->tmpUrl = $ossPath; | |
92 | + $e->message = 'ok'; | |
93 | + | |
94 | + return $this->renderJson($e); | |
95 | + } | |
96 | + | |
97 | + /** | |
98 | + * @param $imgPath | |
99 | + * @return null|resource | |
100 | + */ | |
101 | + private function _imageCreateFromPath($imgPath) | |
102 | + { | |
103 | + list($width, $height, $type, $attr) = getimagesize($imgPath); | |
104 | + switch ($type) { | |
105 | + case 3: // png | |
106 | + return imagecreatefrompng($imgPath); | |
107 | + case 2: // jpeg | |
108 | + return imagecreatefromjpeg($imgPath); | |
109 | + default: | |
110 | + return null; | |
111 | + } | |
112 | + } | |
113 | + | |
114 | + /** | |
30 | 115 | * 提交激活 - (enter-controller.js提交激活页面用到) |
31 | 116 | */ |
32 | 117 | public function actionSubmit() |
33 | 118 | { |
34 | 119 | $request = Yii::$app->request; |
35 | 120 | $fileData = $request->post("file_data"); |
121 | + $vedioData = $request->post("vedio_data"); | |
36 | 122 | $address = $request->post("address"); |
37 | 123 | $content = $request->post("content"); |
38 | 124 | $phone = $request->post("phone"); |
... | ... | @@ -47,22 +133,13 @@ class DefaultController extends BaseController |
47 | 133 | $e->msg = '用户未登录'; |
48 | 134 | return $this->renderJson($e); |
49 | 135 | } |
50 | - | |
51 | - if (empty($fileData) || empty($address) || empty($content) || empty($phoneHeader) || empty($phone) || empty($uuid)) { | |
136 | + $INPUT_VA = ((!empty($fileData) || !empty($address) || !empty($vedioData) || !empty($content)) && (empty($phone) || empty($phoneHeader))); | |
137 | + if ($INPUT_VA || empty($uuid)) { | |
52 | 138 | $e->msg = '保存失败缺少必要参数'; |
53 | 139 | return $this->renderJson($e); |
54 | 140 | } |
55 | - $productImagePath = ""; | |
141 | + $productImagePath = []; | |
56 | 142 | $productVedioPath = ""; |
57 | - $imagePath = explode(".", $fileData); | |
58 | - $suffix = end($imagePath); | |
59 | - if ($suffix == "mp4") { | |
60 | - $productVedioPath = $fileData; | |
61 | - } else { | |
62 | - $productImagePath = $fileData; | |
63 | - } | |
64 | - // 保存图片到OSS | |
65 | - $img_path = $fileData; | |
66 | 143 | |
67 | 144 | // 校验UUID是否有效 2 无效 0 有效未激活 1 有效已激活 |
68 | 145 | $checkResult = CheckActiveHelper::getAppActivate($uuid); |
... | ... | @@ -89,15 +166,35 @@ class DefaultController extends BaseController |
89 | 166 | return $this->renderJson($e); |
90 | 167 | } |
91 | 168 | |
92 | - $newPath = ImageManager::getSmartImgPath($userId, $suffix); | |
93 | - | |
94 | - ImageManager::move($img_path, $newPath); | |
169 | + // 上传图片 | |
170 | + if (!empty($fileData)) { | |
171 | + $images = explode(",", $fileData); | |
172 | + foreach ($images as $key => $image) { | |
173 | + if (empty($image)) { | |
174 | + continue; | |
175 | + } | |
176 | + $imagePath = explode(".", $image); | |
177 | + $suffix = end($imagePath); | |
178 | + $imageFileNameStr = isset($imagePath[0]) ? $imagePath[0] : ""; | |
179 | + // 保存图片到OSS | |
180 | + $newPath = ImageManager::getSmartImgPath($userId, $imageFileNameStr, $suffix); | |
181 | + ImageManager::move($image, $newPath); | |
182 | + $productImagePath[] = ["path" => $newPath]; | |
183 | + } | |
184 | + } | |
185 | + $productImagePath = empty($productImagePath) ? "" : json_encode($productImagePath); | |
95 | 186 | |
96 | - if ($suffix == "mp4") { | |
97 | - $productVedioPath = $newPath; | |
98 | - } else { | |
99 | - $productImagePath = $newPath; | |
187 | + // 上传视频 | |
188 | + if (!empty($vedioData)) { | |
189 | + $vedioDataArr = explode(".", $vedioData); | |
190 | + $vedioSuffix = end($vedioDataArr); | |
191 | + $fileNameStr = isset($vedioDataArr[0]) ? $vedioDataArr[0] : ""; | |
192 | + // 保存视频到OSS | |
193 | + $newVedioPath = ImageManager::getSmartImgPath($userId, $fileNameStr, $vedioSuffix); | |
194 | + ImageManager::move($vedioData, $newVedioPath); | |
195 | + $productVedioPath = $newVedioPath; | |
100 | 196 | } |
197 | + | |
101 | 198 | $getCode = rand(10000, 99999); |
102 | 199 | $saveData = [ |
103 | 200 | "user_mp_id" => $userId, |
... | ... | @@ -113,8 +210,10 @@ class DefaultController extends BaseController |
113 | 210 | $result = SellerInputRecord::create($saveData); |
114 | 211 | if ($result) { |
115 | 212 | try { |
116 | - $sms = new SmsMessage(); | |
117 | - $sms->sendGetCode($phoneHeader.$phone, $getCode); | |
213 | + if (!empty($phoneHeader.$phone)) { | |
214 | + $sms = new SmsMessage(); | |
215 | + $sms->sendGetCode($phoneHeader.$phone, $getCode); | |
216 | + } | |
118 | 217 | } catch (\Exception $e) { } |
119 | 218 | $e->success = true; |
120 | 219 | $e->msg = '激活成功!'; | ... | ... |
app-wx/modules/smart/views/default/pages/enter-template.php
... | ... | @@ -11,12 +11,25 @@ $baseUrl = Url::base(true); |
11 | 11 | <?=$this->render("styles/_enter-style", ["baseUrl" => $baseUrl])?> |
12 | 12 | <div class="up-part"> |
13 | 13 | <div class="input-item-cls"> |
14 | - <label class="pub-title">上传商品图片/视频<span class="require-cls">(图片<2M ,视频<10M mp4格式)</span></label> | |
14 | + <label class="pub-title">上传商品图片<span class="require-cls">(最多3张,每张图片<5M)</span></label> | |
15 | 15 | <div class="img-box-cls"> |
16 | 16 | <ul id ="image-list" style="overflow: hidden;margin-top:0.5rem; margin-bottom: 0.5rem;"> |
17 | 17 | <li class="upload-li upload-btn-li"> |
18 | 18 | <div class="upload-item upload-btn-cls"> |
19 | - <!--<input type="file" id="upload-btn" class="upload-input-cls" name="file" accept="image/*"/>--> | |
19 | + <input type="file" id="upload-btn" class="upload-input-cls" name="file" accept="image/*"/> | |
20 | + </div> | |
21 | + <li> | |
22 | + </ul> | |
23 | + </div> | |
24 | + </div> | |
25 | + <div class="space-line"></div> | |
26 | + <div class="input-item-cls"> | |
27 | + <label class="pub-title">上传商品视频<span class="require-cls">(视频<10M mp4格式)</span></label> | |
28 | + <div class="img-box-cls"> | |
29 | + <ul id ="vedio-list" style="overflow: hidden;margin-top:0.5rem; margin-bottom: 0.5rem;"> | |
30 | + <li class="upload-vedio-li upload-vedio-btn-li"> | |
31 | + <div class="upload-vedio-item upload-vedio-btn-cls"> | |
32 | + <input type="file" id="upload-vedio-btn" class="upload-vedio-input-cls" name="file" accept="*.mp4,*.MP4"/> | |
20 | 33 | </div> |
21 | 34 | <li> |
22 | 35 | </ul> |
... | ... | @@ -44,7 +57,7 @@ $baseUrl = Url::base(true); |
44 | 57 | <div class="input-item-cls" style="display:grid;flex-direction: row"> |
45 | 58 | <label class="pub-title">手机号<span class="require-cls">(用于接收“提取码”短信)</span></label> |
46 | 59 | <div class="input-box-cls"> |
47 | - <input class="input-cls phone-number-header" type="number" placeholder="开头(86)" maxlength="6"/> | |
60 | + <input class="input-cls phone-number-header" type="number" placeholder="国家区号" maxlength="6"/> | |
48 | 61 | <input class="input-cls phone-number" type="number" placeholder="请输入手机号" maxlength="15"/> |
49 | 62 | </div> |
50 | 63 | </div> | ... | ... |
app-wx/modules/smart/views/default/pages/error-template.php
... | ... | @@ -33,6 +33,12 @@ $baseUrl = Url::base(true); |
33 | 33 | color:rgba(106,106,106,1); |
34 | 34 | line-height:1.5rem; |
35 | 35 | } |
36 | + #error .timer{ | |
37 | + font-size:0.94rem; | |
38 | + font-weight:400; | |
39 | + color:rgba(106,106,106,1); | |
40 | + line-height:1.41rem; | |
41 | + } | |
36 | 42 | </style> |
37 | 43 | <script id="error-template" type="text/template"> |
38 | 44 | <div class="pages" id="error"> |
... | ... | @@ -47,6 +53,9 @@ $baseUrl = Url::base(true); |
47 | 53 | <div class="scan-button tip-bottom"> |
48 | 54 | 请联系标签客服 |
49 | 55 | </div> |
56 | + <div class="scan-button timer" id="timerDiv"> | |
57 | + 5秒后跳转到激活扫码页 | |
58 | + </div> | |
50 | 59 | </div> |
51 | 60 | </div> |
52 | 61 | </div> | ... | ... |
app-wx/modules/smart/views/default/pages/styles/_enter-style.php
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | #enter .up-part .input-box-cls{width:100%;line-height: 1.25rem;display: inline-flex;} |
14 | 14 | #enter .up-part .input-cls{width: 98.5%;line-height: inherit;font-size: 1rem;border:0} |
15 | 15 | #enter .up-part .content-cls{resize:none;width:100%;border:0;line-height: 1.8rem;height: 6.5rem;font-size: 1rem;background:rgba(242,242,242,1);border-radius:0rem;padding-left: 0.5rem; } |
16 | - #enter .up-part .upload-li{width:25%;float:left;/*padding:0.3rem 0.4rem;*/padding-left:0;box-sizing: border-box; } | |
16 | + #enter .up-part .upload-li{width:25%;float:left;padding:0 0.4rem;padding-left:0;box-sizing: border-box; } | |
17 | 17 | #enter .up-part .upload-item{width:100%;height:0;padding-bottom: 100%;overflow:hidden; |
18 | 18 | background-position: center center; |
19 | 19 | background-repeat: no-repeat; |
... | ... | @@ -44,6 +44,17 @@ |
44 | 44 | padding-left: 0.5rem; |
45 | 45 | color: #fff; |
46 | 46 | font-size: 1rem; |
47 | - position: fixed; | |
47 | + position: absolute; | |
48 | 48 | } |
49 | + #enter .up-part .upload-vedio-li{width:25%;float:left;/*padding:0.3rem 0.4rem;*/padding-left:0;box-sizing: border-box; } | |
50 | + #enter .up-part .upload-vedio-item{width:100%;height:0;padding-bottom: 100%;overflow:hidden; | |
51 | + background-position: center center; | |
52 | + background-repeat: no-repeat; | |
53 | + -webkit-background-size:cover; | |
54 | + -moz-background-size:cover;background-size:cover;position: relative} | |
55 | + #enter .up-part .upload-vedio-btn-cls{background-image:url('<?=$baseUrl?>/i/enter/cover_vedio.png');background-size: 5.15rem auto;background-repeat: no-repeat; | |
56 | + } | |
57 | + #enter .up-part .upload-vedio-input-cls{width: 100%;display: block;height: 5.2rem;background: rgba(0,0,0,0);opacity: 0;} | |
58 | + #enter .up-part .up-vedio-img{position: relative} | |
59 | + #enter .up-part .del-vedio-img{position: absolute;top: 0.2rem;left: 0.2rem;width: 0.8rem;height: 0.9rem;background-image:url('<?=$baseUrl?>/i/enter/trash.png');background-repeat: no-repeat;background-size: 0.8rem auto;background-color:#fff;border-radius: 0.2rem;} | |
49 | 60 | </style> |
50 | 61 | \ No newline at end of file | ... | ... |
app-wx/modules/smart/views/default/pages/success-template.php
... | ... | @@ -27,6 +27,12 @@ $baseUrl = Url::base(true); |
27 | 27 | font-weight:400; |
28 | 28 | color:rgba(0,0,0,1); |
29 | 29 | } |
30 | + #success .timer{ | |
31 | + font-size:0.94rem; | |
32 | + font-weight:400; | |
33 | + color:rgba(106,106,106,1); | |
34 | + line-height:1.41rem; | |
35 | + } | |
30 | 36 | </style> |
31 | 37 | <script id="success-template" type="text/template"> |
32 | 38 | <div class="pages" id="success"> |
... | ... | @@ -38,6 +44,9 @@ $baseUrl = Url::base(true); |
38 | 44 | <div class="scan-button"> |
39 | 45 | 激活成功! |
40 | 46 | </div> |
47 | + <div class="scan-button timer" id="timerDiv"> | |
48 | + 5秒后跳转到激活扫码页 | |
49 | + </div> | |
41 | 50 | </div> |
42 | 51 | </div> |
43 | 52 | </div> | ... | ... |
app-wx/web/dist/js/check-app.js
1 | -define("check-app",["mk7/app"],function(n){var t=Dom7,e=function(){var n=t(".ui-loading-block");0==n.length&&(t(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var n=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",n&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',n.appendChild(t))},window.waitingTime))},o=!0;return n.name="check",n.routes={index:function(){return o=!1,e(),n.runController("index")},"*":function(){return o=!1,e(),n.runController("index")},"scan-count/:uuid/:scancount":function(t,i){return o=!1,e(),n.runController("scan-count",{uuid:t,scancount:i})},"warning/:uuid":function(t){return o=!1,e(),n.runController("warning",{uuid:t})},"submit/:uuid":function(t){return o=!1,e(),n.runController("submit",{uuid:t})},"error/:uuid":function(t){return o=!1,e(),n.runController("error",{uuid:t})},"success/:uuid":function(t){return o=!1,e(),n.runController("success",{uuid:t})},"info/:uuid/:number_code":function(t,i){return o=!1,e(),n.runController("info",{uuid:t,number_code:i})}},n}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,1),r=0,u=2,s=0;return n.run=function(){var n=this;n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),n.scanQrcode(),n.render(),c(".scan-button").attr("disabled","disabled"),c(".scan-button").text("正在调起扫码……")},n.bindEvents=function(){var n=this;c(".scan-button").click(function(){n.scanQrcode()})},n.scanQrcode=function(){var n=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr,d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){if(d.uuid.indexOf("@")==-1)return e.toast({content:"该智能防伪二维码无效"}),!1;var d=d.uuid.split("@"),l=t.to("check#warning/"+d[0]),m=t.to("check#scan-count/"+d[0]+"/"+s);c.ajax({method:"POST",url:t.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){s=n.scan_count,m=t.to("check#scan-count/"+d[0]+"/"+s),n.success==a?window.location.href=m:n.success==r?window.location.href=l:n.success==u?e.toast({content:"该智能防伪二维码无效"}):e.toast({content:"该智能防伪二维码无效"})},error:function(n){},complete:function(t){n.hideIndicator()}})}else e.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){c(".scan-button").removeAttr("disabled"),c(".scan-button").text("点击扫描标签")},1e3)})},n}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("隐私信息"),n.loadData(n.params.uuid,n.params.number_code),n.popstate()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n.loadData=function(n,o){var i=this;c.ajax({method:"POST",url:t.to("check/default/get-info"),data:{uuid:n,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(n){try{n.success?i.render(n.data):e.toast({content:n.message,closeDelay:3e3})}catch(t){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){i.hideIndicator()}})},n.popstate=function(){window.addEventListener("popstate",function(n){window.location.href=t.to("check#index")},!1)},n}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,0),r="";return n.run=function(){var n=this;a=parseInt(n.params.scancount),r=n.params.uuid,n.setPageTitle("验证标签"),n.render(),c(".count-num").html(a)},n.bindEvents=function(){c(".scan-button").click(function(){""!=r&&void 0!=r?window.location.href=t.to("check#submit/"+r):window.location.href=t.to("check#index")})},n}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),n.render()},n.bindEvents=function(){var n=this;c(".scan-image").click(function(){n.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");return e.isEmpty(o)?(e.toast({content:"请拍照文件上传后再试!"}),!1):void c.ajax({method:"POST",url:t.to("check/default/check-actived"),data:{upload_file:o,uuid:a},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=t.to("check#success/"+a):window.location.href=t.to("check#error/"+a)}catch(o){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){n.hideIndicator()}})})},n.uploadImg=function(n){var t=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){e.localIds.length>0&&t.upload(e.localIds,n)}})})},n.upload=function(n,o){var r=this;return void 0==n[0]?"":void i.uploadImage({localId:n[0],isShowProgressTips:1,success:function(n){c.ajax({method:"POST",url:t.to("check/default/update-serviceid"),data:{service_id:n.serverId,uuid:a},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(n){try{if(n.success){var t=n.img_path;o.attr("data",t),o.attr("src",n.show_path)}else e.toast({content:n.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){r.hideIndicator()}})},fail:function(n){r.app.alert(JSON.stringify(n))}})},n}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){var n=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return e.isEmpty(o)?(e.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):e.isEmpty(a)?(e.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:t.to("check/default/get-info"),data:{uuid:a,number_code:o},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=t.to("check#info/"+a+"/"+o):e.toast({content:n.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){n.hideIndicator()}})})},n}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证标签"),n.render()},n.bindEvents=function(){c(".scan-jump-button").click(function(){""!=a&&void 0!=a?window.location.href=t.to("smart#enter/"+a):window.location.href=t.to("check#index")})},n}); | |
2 | 1 | \ No newline at end of file |
2 | +define("check-app",["mk7/app"],function(n){var t=Dom7,e=function(){var n=t(".ui-loading-block");0==n.length&&(t(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var n=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",n&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',n.appendChild(t))},window.waitingTime))},o=!0;return n.name="check",n.routes={index:function(){return o=!1,e(),n.runController("index")},"*":function(){return o=!1,e(),n.runController("index")},"scan-count/:uuid/:scancount":function(t,i){return o=!1,e(),n.runController("scan-count",{uuid:t,scancount:i})},"warning/:uuid":function(t){return o=!1,e(),n.runController("warning",{uuid:t})},"submit/:uuid":function(t){return o=!1,e(),n.runController("submit",{uuid:t})},"error/:uuid":function(t){return o=!1,e(),n.runController("error",{uuid:t})},"success/:uuid":function(t){return o=!1,e(),n.runController("success",{uuid:t})},"info/:uuid/:number_code":function(t,i){return o=!1,e(),n.runController("info",{uuid:t,number_code:i})}},n}),define("check/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)})},n}),define("check/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,1),r=0,s=2,u=0;return n.run=function(){var n=this;n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),n.scanQrcode(),n.render(),c(".scan-button").attr("disabled","disabled"),c(".scan-button").text("正在调起扫码……")},n.bindEvents=function(){var n=this;c(".scan-button").click(function(){n.scanQrcode()})},n.scanQrcode=function(){var n=this;i.ready(function(){i.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(o){var i=o.resultStr,d=c.parseUrlQuery(i);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){if(d.uuid.indexOf("@")==-1)return e.toast({content:"该智能防伪二维码无效"}),!1;var d=d.uuid.split("@"),l=t.to("check#warning/"+d[0]),m=t.to("check#scan-count/"+d[0]+"/"+u);c.ajax({method:"POST",url:t.to("check/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){u=n.scan_count,m=t.to("check#scan-count/"+d[0]+"/"+u),n.success==a?window.location.href=m:n.success==r?window.location.href=l:n.success==s?e.toast({content:"该智能防伪二维码无效"}):e.toast({content:"该智能防伪二维码无效"})},error:function(n){},complete:function(t){n.hideIndicator()}})}else e.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){c(".scan-button").removeAttr("disabled"),c(".scan-button").text("点击扫描标签")},1e3)})},n}),define("check/info-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7;Template7;return n.run=function(){var n=this;n.setPageTitle("隐私信息"),n.loadData(n.params.uuid,n.params.number_code),n.popstate()},n.bindEvents=function(){c(".back-button").click(function(){window.history.go(-1)}),c(".image_button").click(function(){var n=c(this).attr("data-url");return e.isEmpty(n)?(e.toast({content:"该图片不存在",closeDelay:3e3}),!1):void c(".scan-image-div").html('<img src="'+n+'" class="scan-image"/>')}),c(".vedio_button").click(function(){var n=c(this).attr("data-url");if(e.isEmpty(n))return e.toast({content:"该视频不存在",closeDelay:3e3}),!1;var t="<video class='scan-image' style='border: 1px solid #cce1f1;object-fit: fill;' alt='商品视频' ";t+="controls='controls'> <source src='"+n+"' type='video/mp4'>您的浏览器不支持 video 标签。</video>",c(".scan-image-div").html(t)})},n.loadData=function(n,o){var i=this;c.ajax({method:"POST",url:t.to("check/default/get-info"),data:{uuid:n,number_code:o},dataType:"json",beforeSend:function(){i.showIndicator()},success:function(n){try{n.success?i.render(n.data):e.toast({content:n.message,closeDelay:3e3})}catch(t){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){i.hideIndicator()}})},n.popstate=function(){window.addEventListener("popstate",function(n){window.location.href=t.to("check#index")},!1)},n}),define("check/scan-count-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,0),r="";return n.run=function(){var n=this;a=parseInt(n.params.scancount),r=n.params.uuid,n.setPageTitle("验证标签"),n.render(),c(".count-num").html(a)},n.bindEvents=function(){c(".scan-button").click(function(){""!=r&&void 0!=r?window.location.href=t.to("check#submit/"+r):window.location.href=t.to("check#index")})},n}),define("check/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证标签"),i.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),n.render()},n.bindEvents=function(){var n=this;c(".scan-image").click(function(){n.uploadImg(c(this))}),c(".scan-button").click(function(){var o=c(".scan-image").attr("data");return e.isEmpty(o)?(e.toast({content:"请拍照文件上传后再试!"}),!1):void c.ajax({method:"POST",url:t.to("check/default/check-actived"),data:{upload_file:o,uuid:a},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=t.to("check#success/"+a):window.location.href=t.to("check#error/"+a)}catch(o){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){n.hideIndicator()}})})},n.uploadImg=function(n){var t=this;i.ready(function(){i.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){e.localIds.length>0&&t.upload(e.localIds,n)}})})},n.upload=function(n,o){var r=this;return void 0==n[0]?"":void i.uploadImage({localId:n[0],isShowProgressTips:1,success:function(n){c.ajax({method:"POST",url:t.to("check/default/update-serviceid"),data:{service_id:n.serverId,uuid:a},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(n){try{if(n.success){var t=n.img_path;o.attr("data",t),o.attr("src",n.show_path)}else e.toast({content:n.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(n){r.hideIndicator()}})},fail:function(n){r.app.alert(JSON.stringify(n))}})},n}),define("check/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证结果"),n.render()},n.bindEvents=function(){var n=this;c(".btn-submit").click(function(){var o=c(".input-num").val();return e.isEmpty(o)?(e.toast({content:"请填写提取码"}),c(".input-num").focus(),!1):e.isEmpty(a)?(e.toast({content:"缺少必要参数请退出重试"}),!1):void c.ajax({method:"POST",url:t.to("check/default/get-info"),data:{uuid:a,number_code:o},dataType:"json",beforeSend:function(){n.showIndicator()},success:function(n){try{n.success?window.location.href=t.to("check#info/"+a+"/"+o):e.toast({content:n.message,closeDelay:3e3})}catch(i){e.toast({content:"出错",closeDelay:3e3})}},error:function(n){e.toast({content:"提交出错,请联系系统管理员"})},complete:function(t){n.hideIndicator()}})})},n}),define("check/warning-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(n,t,e,o,i){var n=new n,c=Dom7,a=(Template7,"");return n.run=function(){var n=this;a=n.params.uuid,n.setPageTitle("验证标签"),n.render()},n.bindEvents=function(){c(".scan-jump-button").click(function(){""!=a&&void 0!=a?window.location.href=t.to("smart#enter/"+a):window.location.href=t.to("check#index")})},n}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/web/dist/js/cmpts/uploadjs/uploadjs.js
1 | -define([],function(){var e={};return e.uploadFile=function(e){var r={selector:e.selector||"",url:e.url||"",processAppendTo:e.processAppendTo||"",beforeSend:function(e,r){},success:function(r,o){e.success&&e.success(r,o)},complete:function(r,o){e.complete&&e.complete(r,o)},process:function(e){},error:function(r,o){e.error&&e.error(r,o)}};r.beforeSend=function(o,n){if(e.beforeSend)e.beforeSend(o,n);else{var t='<div id="process-bar" style="width:100%;position: absolute;top:0;bottom: 0;z-index: 222;display: flex;justify-content: center;flex-direction: column;"><div style="width: 70%;margin: 0 auto;height:1.5rem;background: #dcdcdc;"><div style="height:1.5rem;width:0%;line-height: 1.5rem;background:#4ae637;text-align:center" id="pro-bar">0%</div></div></div>';if(""!=r.processAppendTo){var s=document.querySelector(r.processAppendTo);if(!s)return"";var c=s.querySelector("#process-bar");s&&c&&s.removeChild(c),s.insertAdjacentHTML("beforeend",t)}}},r.process=function(o){if(e.process)e.process(o);else if(""!=r.processAppendTo){var n=document.querySelector(r.processAppendTo);if(!n)return"";var t=n.querySelector("#pro-bar");if(t){var s=100*o.loaded/o.total,c=Math.floor(s)+"%";t.style.width=c,t.innerHTML=c}}};var o=document.querySelector(r.selector).files[0],n=new FormData,t=new XMLHttpRequest;t.onload=function(e){var o=JSON.parse(this.response);r.success(o,e)},t.onloadend=function(e){if(""!=r.processAppendTo){var o=document.querySelector(r.processAppendTo);if(o){var n=o.querySelector("#process-bar");o&&o.removeChild(n)}}var t=JSON.parse(this.response);r.complete(t,e)},t.onerror=function(e){var o=JSON.parse(this.response);r.error(o,e)},t.ontimeout=function(e){},t.addEventListener("loadstart",function(e){r.beforeSend(e)}),t.open("post",r.url,!0),t.upload.onprogress=function(e){e.lengthComputable&&r.process(e)},n.append("file",o),t.send(n)},e}); | |
2 | 1 | \ No newline at end of file |
2 | +define([],function(){var e={};return e.uploadFile=function(e){var o={selector:e.selector||"",url:e.url||"",processAppendTo:e.processAppendTo||"",timeout:e.timeout||6e3,beforeSend:function(e,o){},success:function(o,r){e.success&&e.success(o,r)},complete:function(o,r){e.complete&&e.complete(o,r)},process:function(e){},ontimeout:function(e){},error:function(o,r){e.error&&e.error(o,r)}};o.beforeSend=function(r,t){if(e.beforeSend)e.beforeSend(r,t);else{var n='<div id="process-bar" style="width:100%;position: absolute;top:0;bottom: 0;z-index: 222;display: flex;justify-content: center;flex-direction: column;"><div style="width: 70%;margin: 0 auto;height:1.5rem;background: #dcdcdc;"><div style="height:1.5rem;width:0%;line-height: 1.5rem;background:#4ae637;text-align:center" id="pro-bar">0%</div></div></div>';if(""!=o.processAppendTo){var s=document.querySelector(o.processAppendTo);if(!s)return"";var i=s.querySelector("#process-bar");s&&i&&s.removeChild(i),s.insertAdjacentHTML("beforeend",n)}}},o.process=function(r){if(e.process)e.process(r);else if(""!=o.processAppendTo){var t=document.querySelector(o.processAppendTo);if(!t)return"";var n=t.querySelector("#pro-bar");if(n){var s=100*r.loaded/r.total,i=Math.floor(s)+"%";n.style.width=i,n.innerHTML=i}}},o.ontimeout=function(o){e.ontimeout?e.ontimeout(o):console.log("time out")};var r=document.querySelector(o.selector).files[0],t=new FormData,n=new XMLHttpRequest;n.timeout=o.timeout,n.onload=function(e){var r=JSON.parse(this.response);o.success(r,e)},n.onloadend=function(e){if(""!=o.processAppendTo){var r=document.querySelector(o.processAppendTo);if(r){var t=r.querySelector("#process-bar");r&&r.removeChild(t)}}var n=JSON.parse(this.response);o.complete(n,e)},n.onerror=function(e){var r=JSON.parse(this.response);o.error(r,e)},n.ontimeout=function(e){console.log("request timeout"),o.ontimeout(e)},n.addEventListener("loadstart",function(e){o.beforeSend(e)}),n.open("post",o.url,!0),n.upload.onprogress=function(e){e.lengthComputable&&o.process(e)},t.append("file",r),n.send(t)},e}); | |
3 | 3 | \ No newline at end of file | ... | ... |
app-wx/web/dist/js/smart-app.js
1 | -define("smart/actived-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(t))},window.waitingTime))},i=!0;return e.name="smart",e.routes={index:function(){return i=!1,n(),e.runController("index")},"enter/:uuid":function(t){i=!1,n();var o={uuid:t};return e.runController("enter",o)},"*":function(){return i=!1,n(),e.runController("index")},actived:function(){return i=!1,n(),e.runController("actived")},error:function(){return i=!1,n(),e.runController("error")},success:function(){return i=!1,n(),e.runController("success")},"error-url":function(){return i=!1,n(),e.runController("error-url")}},e}),define("smart/enter-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin","mk7/uploadjs"],function(e,t,n,i,o,r){var e=new e,s=Dom7,a=(Template7,"smart/default/submit"),c=1,d="",u=!1;return e.run=function(){var e=this;e.setPageTitle("激活标签"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),d=e.params.uuid,e.hideAllNonBaseMenuItem(window.$site),e.render(),e.loadAddress()},e.bindEvents=function(){var e=this;s("#enter").on("click",".upload-btn-cls",function(){var t=s(this).parents("li");e.uploadImg(t)}),s("#enter").on("click",".del-img",function(e){s(this).parent().remove(),c>=s("#image-list").find(".up-img").length&&s(".upload-btn-li").show()}),s("#enter").on("click",".up-img .upload-item",function(e){var t=s(this).attr("data-url");s("#img-mask").remove();var n='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+t+'" /></div><div id="set-convert-btn" style="position: absolute;bottom: 0;width: 100%;color: #000;text-align: center;padding: 1rem 0;z-index: 2;background: rgba(255,255,255,0.5)">设置为封面</div></div>';s("#publish").append(n)}),s("#enter").on("click","#dropdown-address",function(e){s(".address-input").val(s(this).html())}),s("#enter").on("click","#set-convert-btn",function(e){var t=s(this).parent().find("img").attr("src");s("#publish .convert-img").remove(),s('div[data-url="'+t+'"]').append('<div class="convert-img">封面</div>'),s("#img-mask").remove()}),s("#enter").on("click","#img-mask, #img-mask img",function(e){s("#img-mask").remove()}),s("#enter").on("click",".submit-btn",function(){if(n.isEmpty(d))return n.toast({content:"进入方式不对,请从新扫码激活",closeDelay:3e3}),!1;var i=s(".upload-item").attr("data"),o=s(".address-input").val(),r=s(".content-cls").val(),c=s(".phone-number").val(),u=s(".phone-number-header").val();return n.isEmpty(i)?(n.toast({content:"请选择商品图片或视频",closeDelay:3e3}),!1):n.isEmpty(o)?(n.toast({content:"请填写发货地址",closeDelay:3e3}),s(".address-input").focus(),!1):n.isEmpty(r)?(n.toast({content:"请填写商家留言",closeDelay:3e3}),s(".content-cls").focus(),!1):n.isEmpty(u)?(n.toast({content:"请填写手机号码开头",closeDelay:3e3}),s(".phone-number-header").focus(),!1):"86"!=u||n.isMobile(c)?(s(".submit-btn").attr("disabled","disabled"),void s.ajax({method:"POST",url:a,data:{file_data:i,address:o,content:r,phone:c,phone_header:u,uuid:d},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success?(s(".submit-btn").removeAttr("disabled"),window.location.href=t.to("smart#success")):window.location.href=t.to("smart#error")},error:function(e){n.alert(e.responseText)},complete:function(t){s(".submit-btn").removeAttr("disabled"),e.hideIndicator()}})):(n.toast({content:"请填写正确手机号码",closeDelay:3e3}),s(".phone-number").focus(),!1)})},e.uploadImg=function(e){var t=this;o.ready(function(){o.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(n){n.localIds.length>0&&t.upload(n.localIds,e)}})})},e.upload=function(e,i){var r=this;return void 0==e[0]?"":void o.uploadImage({localId:e[0],isShowProgressTips:1,success:function(e){s.ajax({method:"POST",url:t.to("smart/default/update-serviceid"),data:{service_id:e.serverId},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(e){try{if(e.success){var t=e.img_path,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.img_path+'" data-url="'+t+'" class="upload-item" style="background-image:url('+e.show_path+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(i),c==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:3e3})}catch(r){n.toast({content:"出错",closeDelay:3e3})}},error:function(e){alert(e.responseText),n.toast({content:"提交出错,请联系系统管理员"+e.responseText})},complete:function(e){r.hideIndicator()}})},fail:function(e){r.app.alert(JSON.stringify(e))}})},e.loadAddress=function(){var e=this;s.ajax({method:"POST",url:t.to("smart/default/select-address"),data:{},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){try{e.success&&""!=e.address&&(u=!0,s("#dropdown-address").html(e.address),s(".address-input").focus(function(e){u&&s("#dropdown-address").show()}),s(".address-input").blur(function(e){u&&s("#dropdown-address").hide()}))}catch(t){}},error:function(e){},complete:function(t){e.hideIndicator()}})},e}),define("smart/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),setTimeout(function(){window.location.href=t.to("smart#index")},5e3)},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart/error-url-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7,s=(Template7,1),a=0,c=2;return e.run=function(){var e=this;e.setPageTitle("智能防伪扫码"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),e.scanQrcode(),e.render(),r(".scan-button").attr("disabled","disabled"),r(".scan-button").text("正在调起扫码……")},e.bindEvents=function(){var e=this;r(".scan-button").click(function(){e.scanQrcode()})},e.scanQrcode=function(){var e=this;o.ready(function(){o.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(i){var o=i.resultStr,d=r.parseUrlQuery(o);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){if(d.uuid.indexOf("@")==-1)return n.toast({content:"该智能防伪二维码无效"}),!1;var d=d.uuid.split("@"),u=t.to("smart#enter/"+d[0]),l=t.to("smart#actived"),m=t.to("smart#error-url");r.ajax({method:"POST",url:t.to("smart/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success==s?window.location.href=l:e.success==a?window.location.href=u:e.success==c?window.location.href=m:window.location.href=m},error:function(e){},complete:function(t){e.hideIndicator()}})}else n.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){r(".scan-button").removeAttr("disabled"),r(".scan-button").text("点击扫描标签")},1e3)})},e}),define("smart/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),setTimeout(function(){window.location.href=t.to("smart#index")},5e3)},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}); | |
2 | 1 | \ No newline at end of file |
2 | +define("smart/actived-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(t))},window.waitingTime))},i=!0;return e.name="smart",e.routes={index:function(){return i=!1,n(),e.runController("index")},"enter/:uuid":function(t){i=!1,n();var o={uuid:t};return e.runController("enter",o)},"*":function(){return i=!1,n(),e.runController("index")},actived:function(){return i=!1,n(),e.runController("actived")},error:function(){return i=!1,n(),e.runController("error")},success:function(){return i=!1,n(),e.runController("success")},"error-url":function(){return i=!1,n(),e.runController("error-url")}},e}),define("smart/enter-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin","mk7/uploadjs"],function(e,t,n,i,o,r){var e=new e,s=Dom7,a=(Template7,"smart/default/upload-img"),l="smart/default/submit",d=3,c=1,u="",m=!1;return e.run=function(){var e=this;e.setPageTitle("激活标签"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["chooseImage","previewImage","uploadImage","getLocalImgData"]}),u=e.params.uuid,e.hideAllNonBaseMenuItem(window.$site),e.render(),e.loadAddress()},e.bindEvents=function(){var e=this;s("#upload-btn").change(function(){if(""!=s(this).val()&&null!=s(this).val()){if(d==s("#image-list").find(".up-img").length)return n.toast({content:"最多只能上传三张商品图片",closeDelay:3e3}),!1;var e=s(this).parents("li");r.uploadFile({selector:"#upload-btn",url:a,processAppendTo:"#enter",success:function(t,i){try{if(t.success){var o=t.tmpUrl,r="";0==s("#image-list").find(".convert-img").length&&(r='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+t.tmpFile+'" data-url="'+o+'" class="upload-item" style="background-image:url('+t.tmpMinUrl+')">'+r+'</div><span class="del-img"></span></li>').insertBefore(e),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:t.message,closeDelay:5e3})}catch(a){console.log(a),n.toast({content:"出错",closeDelay:5e3})}}})}}),s("#upload-vedio-btn").change(function(){if(""!=s(this).val()&&null!=s(this).val()){if(c==s("#vedio-list").find(".up-vedio-img").length)return n.toast({content:"只能上传一个商品视频",closeDelay:3e3}),!1;var e=s(this).parents("li");r.uploadFile({selector:"#upload-vedio-btn",url:a,processAppendTo:"#enter",success:function(t,i){try{if(t.success){var o=t.tmpUrl,r="";0==s("#vedio-list").find(".convert-img").length&&(r='<div class="convert-img">封面</div>'),s('<li class="upload-vedio-li up-vedio-img"><div data="'+t.tmpFile+'" data-url="'+o+'" class="upload-vedio-item" style="background-image:url('+t.tmpMinUrl+')">'+r+'</div><span class="del-vedio-img"></span></li>').insertBefore(e),c==s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").hide()}else n.toast({content:t.message,closeDelay:5e3})}catch(a){console.log(a),n.toast({content:"出错",closeDelay:5e3})}}})}}),s("#enter").on("click",".del-img",function(e){s(this).parent().remove(),d>=s("#image-list").find(".up-img").length&&s(".upload-btn-li").show()}),s("#enter").on("click",".del-vedio-img",function(e){s(this).parent().remove(),c>=s("#vedio-list").find(".up-vedio-img").length&&s(".upload-vedio-btn-li").show()}),s("#enter").on("click","#dropdown-address",function(e){s(".address-input").val(s(this).html())}),s("#enter").on("click",".submit-btn",function(){if(n.isEmpty(u))return n.toast({content:"进入方式不对,请从新扫码激活",closeDelay:3e3}),!1;var i=s(".upload-vedio-item").attr("data"),o="";s(".upload-item").each(function(){var e=s(this).attr("data");n.isEmpty(e)||(o+=s(this).attr("data")+",")}),""!=o&&(o=o.substring(0,o.length-1));var r=s(".address-input").val(),a=s(".content-cls").val(),d=s(".phone-number").val(),c=s(".phone-number-header").val();if(!(n.isEmpty(i)&&n.isEmpty(o)&&n.isEmpty(r)&&n.isEmpty(a))){if(n.isEmpty(c))return n.toast({content:"请填写国家区号",closeDelay:3e3}),s(".phone-number-header").focus(),!1;if("86"==c&&!n.isMobile(d))return n.toast({content:"请填写正确手机号码",closeDelay:3e3}),s(".phone-number").focus(),!1}s(".submit-btn").attr("disabled","disabled"),s.ajax({method:"POST",url:l,data:{file_data:o,vedio_data:i,address:r,content:a,phone:d,phone_header:c,uuid:u},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success?(s(".submit-btn").removeAttr("disabled"),window.location.href=t.to("smart#success")):window.location.href=t.to("smart#error")},error:function(e){n.alert(e.responseText)},complete:function(t){s(".submit-btn").removeAttr("disabled"),e.hideIndicator()}})})},e.uploadImg=function(e){var t=this;o.ready(function(){o.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(n){n.localIds.length>0&&t.upload(n.localIds,e)}})})},e.upload=function(e,i){var r=this;return void 0==e[0]?"":void o.uploadImage({localId:e[0],isShowProgressTips:1,success:function(e){s.ajax({method:"POST",url:t.to("smart/default/update-serviceid"),data:{service_id:e.serverId},dataType:"json",beforeSend:function(){r.showIndicator()},success:function(e){try{if(e.success){var t=e.img_path,o="";0==s("#image-list").find(".convert-img").length&&(o='<div class="convert-img">封面</div>'),s('<li class="upload-li up-img"><div data="'+e.img_path+'" data-url="'+t+'" class="upload-item" style="background-image:url('+e.show_path+')">'+o+'</div><span class="del-img"></span></li>').insertBefore(i),d==s("#image-list").find(".up-img").length&&s(".upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:3e3})}catch(r){n.toast({content:"出错",closeDelay:3e3})}},error:function(e){alert(e.responseText),n.toast({content:"提交出错,请联系系统管理员"+e.responseText})},complete:function(e){r.hideIndicator()}})},fail:function(e){r.app.alert(JSON.stringify(e))}})},e.loadAddress=function(){var e=this;s.ajax({method:"POST",url:t.to("smart/default/select-address"),data:{},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){try{e.success&&""!=e.address&&(m=!0,s("#dropdown-address").html(e.address),s(".address-input").focus(function(e){m&&s("#dropdown-address").show()}),s(".address-input").blur(function(e){m&&s("#dropdown-address").hide()}))}catch(t){}},error:function(e){},complete:function(t){e.hideIndicator()}})},e}),define("smart/error-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}),define("smart/error-url-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活标签"),e.render()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e}),define("smart/index-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7,s=(Template7,1),a=0,l=2;return e.run=function(){var e=this;e.setPageTitle("智能防伪扫码"),o.config({debug:!1,appId:window.$site.appid,timestamp:window.$site.timestamp,nonceStr:window.$site.noncestr,signature:window.$site.signature,jsApiList:["openLocation","getLocation","scanQRCode"]}),e.scanQrcode(),e.render(),r(".scan-button").attr("disabled","disabled"),r(".scan-button").text("正在调起扫码……")},e.bindEvents=function(){var e=this;r(".scan-button").click(function(){e.scanQrcode()})},e.scanQrcode=function(){var e=this;o.ready(function(){o.scanQRCode({needResult:1,desc:"scanQRCode desc",success:function(i){var o=i.resultStr,d=r.parseUrlQuery(o);if(null!=d&&void 0!==d&&null!=d.uuid&&void 0!==d.uuid){if(d.uuid.indexOf("@")==-1)return n.toast({content:"该智能防伪二维码无效"}),!1;var d=d.uuid.split("@"),c=t.to("smart#enter/"+d[0]),u=t.to("smart#actived"),m=t.to("smart#error-url");r.ajax({method:"POST",url:t.to("smart/default/check-active"),data:{uuid:d[0]},dataType:"json",beforeSend:function(){e.showIndicator()},success:function(e){e.success==s?window.location.href=u:e.success==a?window.location.href=c:e.success==l?window.location.href=m:window.location.href=m},error:function(e){},complete:function(t){e.hideIndicator()}})}else n.toast({content:"请扫描智能防伪二维码"})}}),setTimeout(function(){r(".scan-button").removeAttr("disabled"),r(".scan-button").text("点击扫描标签")},1e3)})},e}),define("smart/success-controller",["mk7/controller","mk7/url","mk7/utils","mk7/modals","mk7/jweixin"],function(e,t,n,i,o){var e=new e,r=Dom7;Template7;return e.run=function(){var e=this;e.setPageTitle("激活结果"),e.render(),e.setTimer()},e.bindEvents=function(){r(".back-button").click(function(){window.history.go(-1)})},e.setTimer=function(){var e=4,i=window.setInterval(function(){return 0==e?(window.location.href=t.to("smart#index"),void(n.isEmpty(i)||clearInterval(i))):(r("#timerDiv").html(e+"秒后跳转到激活扫码页"),void e--)},1e3)},e}); | |
3 | 3 | \ No newline at end of file | ... | ... |
46.5 KB
2.8 KB
9.91 KB
app-wx/web/src/js/check/info-controller.js
... | ... | @@ -27,6 +27,24 @@ define( |
27 | 27 | $$(".back-button").click(function () { |
28 | 28 | window.history.go(-1); |
29 | 29 | }); |
30 | + $$(".image_button").click(function () { | |
31 | + var showUrl = $$(this).attr("data-url"); | |
32 | + if (utils.isEmpty(showUrl)) { | |
33 | + utils.toast({content:'该图片不存在', closeDelay:3000}); | |
34 | + return false; | |
35 | + } | |
36 | + $$(".scan-image-div").html("<img src=\"" + showUrl + "\" class=\"scan-image\"/>"); | |
37 | + }); | |
38 | + $$(".vedio_button").click(function () { | |
39 | + var showUrl = $$(this).attr("data-url"); | |
40 | + if (utils.isEmpty(showUrl)) { | |
41 | + utils.toast({content:'该视频不存在', closeDelay:3000}); | |
42 | + return false; | |
43 | + } | |
44 | + var insertHtmlContent = "<video class='scan-image' style='border: 1px solid #cce1f1;object-fit: fill;' alt='商品视频' "; | |
45 | + insertHtmlContent += "controls='controls'> <source src='" + showUrl + "' type='video/mp4'>您的浏览器不支持 video 标签。</video>"; | |
46 | + $$(".scan-image-div").html(insertHtmlContent); | |
47 | + }); | |
30 | 48 | }; |
31 | 49 | |
32 | 50 | ctrl.loadData = function (uuid, numberCode) { | ... | ... |
app-wx/web/src/js/smart/enter-controller.js
... | ... | @@ -17,7 +17,8 @@ define( |
17 | 17 | var t7 = Template7; |
18 | 18 | var uploadURL = 'smart/default/upload-img'; |
19 | 19 | var submitURL = 'smart/default/submit'; |
20 | - var imgLimit = 1; | |
20 | + var imgLimit = 3; | |
21 | + var vedioLimit = 1; | |
21 | 22 | var uuid = ""; |
22 | 23 | var canShow = false; |
23 | 24 | |
... | ... | @@ -40,17 +41,21 @@ define( |
40 | 41 | |
41 | 42 | ctrl.bindEvents = function () { |
42 | 43 | var me = this; |
43 | - /* 直接选择文件方式上传(如果有引用双开的手机可能会出现权限问题) | |
44 | + // 上传商品图片 | |
44 | 45 | $$('#upload-btn').change(function() { |
45 | 46 | if ('' == $$(this).val() || null == $$(this).val()) { |
46 | 47 | return ; |
47 | 48 | } |
49 | + if (imgLimit == $$('#image-list').find('.up-img').length) { | |
50 | + utils.toast({content:'最多只能上传三张商品图片', closeDelay:3000}); | |
51 | + return false; | |
52 | + } | |
48 | 53 | var uploadParent = $$(this).parents('li'); |
49 | 54 | |
50 | 55 | uploadjs.uploadFile({ |
51 | 56 | selector:'#upload-btn', |
52 | 57 | url:uploadURL, |
53 | - processAppendTo:'#publish', | |
58 | + processAppendTo:'#enter', | |
54 | 59 | success:function(response, e) { |
55 | 60 | try { |
56 | 61 | if(response.success) { |
... | ... | @@ -73,72 +78,98 @@ define( |
73 | 78 | } |
74 | 79 | } |
75 | 80 | }); |
76 | - })*/ | |
77 | - $$('#enter').on('click', '.upload-btn-cls', function() { | |
81 | + }) | |
82 | + | |
83 | + // 上传商品视频 | |
84 | + $$('#upload-vedio-btn').change(function() { | |
85 | + if ('' == $$(this).val() || null == $$(this).val()) { | |
86 | + return ; | |
87 | + } | |
88 | + if (vedioLimit == $$('#vedio-list').find('.up-vedio-img').length) { | |
89 | + utils.toast({content:'只能上传一个商品视频', closeDelay:3000}); | |
90 | + return false; | |
91 | + } | |
92 | + var uploadParent = $$(this).parents('li'); | |
93 | + | |
94 | + uploadjs.uploadFile({ | |
95 | + selector:'#upload-vedio-btn', | |
96 | + url:uploadURL, | |
97 | + processAppendTo:'#enter', | |
98 | + success:function(response, e) { | |
99 | + try { | |
100 | + if(response.success) { | |
101 | + var vedioUrl = response.tmpUrl; | |
102 | + var converts = ''; | |
103 | + if (0 == $$('#vedio-list').find('.convert-img').length) { | |
104 | + converts = '<div class="convert-img">封面</div>'; | |
105 | + } | |
106 | + | |
107 | + $$('<li class="upload-vedio-li up-vedio-img"><div data="'+response.tmpFile+'" data-url="'+vedioUrl+'" class="upload-vedio-item" style="background-image:url('+response.tmpMinUrl+')">'+converts+'</div><span class="del-vedio-img"></span></li>').insertBefore(uploadParent); | |
108 | + if (vedioLimit == $$('#vedio-list').find('.up-vedio-img').length) { | |
109 | + $$('.upload-vedio-btn-li').hide(); | |
110 | + } | |
111 | + } else { | |
112 | + utils.toast({content:response.message, closeDelay:5000}); | |
113 | + } | |
114 | + } catch(ex) { | |
115 | + console.log(ex) | |
116 | + utils.toast({content:'出错', closeDelay:5000}); | |
117 | + } | |
118 | + } | |
119 | + }); | |
120 | + }) | |
121 | + /*$$('#enter').on('click', '.upload-btn-cls', function() { | |
78 | 122 | var uploadParent = $$(this).parents('li'); |
79 | 123 | me.uploadImg(uploadParent); |
80 | - }); | |
124 | + });*/ | |
81 | 125 | $$('#enter').on('click', '.del-img', function(e){ |
82 | 126 | $$(this).parent().remove(); |
83 | 127 | if (imgLimit >= $$('#image-list').find('.up-img').length) { |
84 | 128 | $$('.upload-btn-li').show(); |
85 | 129 | } |
86 | 130 | }) |
87 | - $$('#enter').on('click','.up-img .upload-item', function(e) { | |
88 | - var url = $$(this).attr('data-url'); | |
89 | - $$('#img-mask').remove(); | |
90 | - var imgContent = '<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+url+'" /></div><div id="set-convert-btn" style="position: absolute;bottom: 0;width: 100%;color: #000;text-align: center;padding: 1rem 0;z-index: 2;background: rgba(255,255,255,0.5)">设置为封面</div></div>'; | |
91 | - $$('#publish').append(imgContent); | |
131 | + $$('#enter').on('click', '.del-vedio-img', function(e){ | |
132 | + $$(this).parent().remove(); | |
133 | + if (vedioLimit >= $$('#vedio-list').find('.up-vedio-img').length) { | |
134 | + $$('.upload-vedio-btn-li').show(); | |
135 | + } | |
92 | 136 | }) |
93 | - | |
94 | 137 | $$('#enter').on('click','#dropdown-address', function(e) { |
95 | 138 | $$(".address-input").val($$(this).html()); |
96 | 139 | }) |
97 | - | |
98 | - $$('#enter').on('click', '#set-convert-btn', function(e) { | |
99 | - var url = $$(this).parent().find('img').attr('src'); | |
100 | - $$('#publish .convert-img').remove(); | |
101 | - $$('div[data-url="'+url+'"]').append('<div class="convert-img">封面</div>'); | |
102 | - $$('#img-mask').remove(); | |
103 | - }) | |
104 | - $$('#enter').on('click', '#img-mask, #img-mask img',function(e) { | |
105 | - $$('#img-mask').remove(); | |
106 | - }) | |
107 | 140 | $$('#enter').on('click', '.submit-btn', function () { |
108 | 141 | if (utils.isEmpty(uuid)) { |
109 | 142 | utils.toast({content:'进入方式不对,请从新扫码激活', closeDelay:3000}); |
110 | 143 | return false; |
111 | 144 | } |
112 | - var fileData = $$(".upload-item").attr("data"); | |
145 | + var fileVedioData = $$(".upload-vedio-item").attr("data"); | |
146 | + var fileData = ""; | |
147 | + $$(".upload-item").each(function () { | |
148 | + var uploadItemFile = $$(this).attr("data"); | |
149 | + if (!utils.isEmpty(uploadItemFile)) { | |
150 | + fileData += $$(this).attr("data") + ","; | |
151 | + } | |
152 | + }); | |
153 | + if (fileData != "") { | |
154 | + fileData = fileData.substring(0, fileData.length - 1); | |
155 | + } | |
113 | 156 | var address = $$(".address-input").val(); |
114 | 157 | var content = $$(".content-cls").val(); |
115 | 158 | var phoneNumber = $$(".phone-number").val(); |
116 | 159 | var phoneNumberHeader = $$(".phone-number-header").val(); |
117 | - if (utils.isEmpty(fileData)) { | |
118 | - utils.toast({content:'请选择商品图片或视频', closeDelay:3000}); | |
119 | - return false; | |
120 | - } | |
121 | - if (utils.isEmpty(address)) { | |
122 | - utils.toast({content:'请填写发货地址', closeDelay:3000}); | |
123 | - $$(".address-input").focus(); | |
124 | - return false; | |
125 | - } | |
126 | - if (utils.isEmpty(content)) { | |
127 | - utils.toast({content:'请填写商家留言', closeDelay:3000}); | |
128 | - $$(".content-cls").focus(); | |
129 | - return false; | |
130 | - } | |
131 | - if (utils.isEmpty(phoneNumberHeader)) { | |
132 | - utils.toast({content:'请填写手机号码开头', closeDelay:3000}); | |
133 | - $$(".phone-number-header").focus(); | |
134 | - return false; | |
135 | - } | |
136 | - if (phoneNumberHeader == "86") { | |
137 | - if (!utils.isMobile(phoneNumber)) { | |
138 | - utils.toast({content:'请填写正确手机号码', closeDelay:3000}); | |
139 | - $$(".phone-number").focus(); | |
160 | + if (!utils.isEmpty(fileVedioData) || !utils.isEmpty(fileData) || !utils.isEmpty(address)|| !utils.isEmpty(content)) { | |
161 | + if (utils.isEmpty(phoneNumberHeader)) { | |
162 | + utils.toast({content: '请填写国家区号', closeDelay: 3000}); | |
163 | + $$(".phone-number-header").focus(); | |
140 | 164 | return false; |
141 | 165 | } |
166 | + if (phoneNumberHeader == "86") { | |
167 | + if (!utils.isMobile(phoneNumber)) { | |
168 | + utils.toast({content: '请填写正确手机号码', closeDelay: 3000}); | |
169 | + $$(".phone-number").focus(); | |
170 | + return false; | |
171 | + } | |
172 | + } | |
142 | 173 | } |
143 | 174 | $$('.submit-btn').attr("disabled", "disabled"); |
144 | 175 | $$.ajax({ |
... | ... | @@ -146,6 +177,7 @@ define( |
146 | 177 | url: submitURL, |
147 | 178 | data : { |
148 | 179 | file_data: fileData, |
180 | + vedio_data: fileVedioData, | |
149 | 181 | address: address, |
150 | 182 | content: content, |
151 | 183 | phone: phoneNumber, | ... | ... |
app-wx/web/src/js/smart/error-controller.js
... | ... | @@ -19,9 +19,7 @@ define( |
19 | 19 | var me = this; |
20 | 20 | me.setPageTitle("激活结果"); |
21 | 21 | me.render(); |
22 | - setTimeout(function () { | |
23 | - window.location.href = url.to('smart#index'); | |
24 | - },5000); | |
22 | + me.setTimer(); | |
25 | 23 | }; |
26 | 24 | |
27 | 25 | ctrl.bindEvents = function () { |
... | ... | @@ -30,6 +28,22 @@ define( |
30 | 28 | window.history.go(-1); |
31 | 29 | }); |
32 | 30 | }; |
31 | + | |
32 | + ctrl.setTimer = function () { | |
33 | + var timercount = 4; | |
34 | + var runInterval = window.setInterval(function() { | |
35 | + if (timercount == 0) { | |
36 | + window.location.href = url.to('smart#index'); | |
37 | + if (!utils.isEmpty(runInterval)) { | |
38 | + clearInterval(runInterval); | |
39 | + } | |
40 | + return; | |
41 | + } | |
42 | + $$("#timerDiv").html(timercount + "秒后跳转到激活扫码页"); | |
43 | + timercount--; | |
44 | + },1000); | |
45 | + } | |
46 | + | |
33 | 47 | return ctrl; |
34 | 48 | } |
35 | 49 | ); |
36 | 50 | \ No newline at end of file | ... | ... |
app-wx/web/src/js/smart/success-controller.js
... | ... | @@ -19,9 +19,7 @@ define( |
19 | 19 | var me = this; |
20 | 20 | me.setPageTitle("激活结果"); |
21 | 21 | me.render(); |
22 | - setTimeout(function () { | |
23 | - window.location.href = url.to('smart#index'); | |
24 | - },5000); | |
22 | + me.setTimer(); | |
25 | 23 | }; |
26 | 24 | |
27 | 25 | ctrl.bindEvents = function () { |
... | ... | @@ -30,6 +28,21 @@ define( |
30 | 28 | window.history.go(-1); |
31 | 29 | }); |
32 | 30 | }; |
31 | + | |
32 | + ctrl.setTimer = function () { | |
33 | + var timercount = 4; | |
34 | + var runInterval = window.setInterval(function() { | |
35 | + if (timercount == 0) { | |
36 | + window.location.href = url.to('smart#index'); | |
37 | + if (!utils.isEmpty(runInterval)) { | |
38 | + clearInterval(runInterval); | |
39 | + } | |
40 | + return; | |
41 | + } | |
42 | + $$("#timerDiv").html(timercount + "秒后跳转到激活扫码页"); | |
43 | + timercount--; | |
44 | + },1000); | |
45 | + } | |
33 | 46 | return ctrl; |
34 | 47 | } |
35 | 48 | ); |
36 | 49 | \ No newline at end of file | ... | ... |
app-wx/web/src/vendor/mk7/cmpts/uploadjs/uploadjs.js
... | ... | @@ -9,10 +9,12 @@ define( |
9 | 9 | selector:options.selector || '', |
10 | 10 | url:options.url || '', |
11 | 11 | processAppendTo: options.processAppendTo || '', |
12 | + timeout:options.timeout || 6000, | |
12 | 13 | beforeSend:function(res, e){}, |
13 | 14 | success:function(res, e){if(options.success){options.success(res, e)}}, |
14 | 15 | complete:function(res, e){if(options.complete){options.complete(res, e)}}, |
15 | 16 | process:function(res){}, |
17 | + ontimeout:function(e){}, | |
16 | 18 | error:function(res, e){if(options.error){options.error(res, e)}} |
17 | 19 | } |
18 | 20 | setting.beforeSend = function(res, e) { |
... | ... | @@ -55,10 +57,18 @@ define( |
55 | 57 | |
56 | 58 | } |
57 | 59 | } |
60 | + setting.ontimeout = function(res) { | |
61 | + if (options.ontimeout) { | |
62 | + options.ontimeout(res); | |
63 | + } else { | |
64 | + console.log('time out') | |
65 | + } | |
66 | + } | |
58 | 67 | |
59 | 68 | var fileObject = document.querySelector(setting.selector).files[0]; |
60 | 69 | var formData = new FormData(); |
61 | 70 | var xhr = new XMLHttpRequest(); |
71 | + xhr.timeout = setting.timeout; | |
62 | 72 | xhr.onload = function(e) { |
63 | 73 | //console.log(this.response); |
64 | 74 | |
... | ... | @@ -86,7 +96,8 @@ define( |
86 | 96 | setting.error(response, e); |
87 | 97 | }; |
88 | 98 | xhr.ontimeout = function(e) { |
89 | - //console.log('request timeout'); | |
99 | + console.log('request timeout'); | |
100 | + setting.ontimeout(e); | |
90 | 101 | }; |
91 | 102 | xhr.addEventListener('loadstart', function(e) { |
92 | 103 | setting.beforeSend(e); | ... | ... |
common/config/params.php
... | ... | @@ -6,7 +6,7 @@ return [ |
6 | 6 | 'ossOptions' => [ |
7 | 7 | 'accessKeyId' => 'LTAI4Fs7QiKCF4ZpZmEGFkcD', |
8 | 8 | 'accessKeySecret' => 'iVs6oI0KknlR2PrRhvQl6f4Xwsudlf', |
9 | - 'endpoint' => 'smart-anti-fake.oss-cn-hongkong.aliyuncs.com', | |
9 | + 'endpoint' => 'smart-anti-fake.oss-cn-hongkong-internal.aliyuncs.com', | |
10 | 10 | 'bucket' => 'smart-anti-fake', |
11 | 11 | 'url' => 'https://smart-anti-fake.oss-cn-hongkong.aliyuncs.com', |
12 | 12 | 'styleUrl' => 'https://smart-anti-fake.oss-cn-hongkong.aliyuncs.com' | ... | ... |
domain/smart/SellerInputRecord.php
... | ... | @@ -22,19 +22,19 @@ class SellerInputRecord |
22 | 22 | try { |
23 | 23 | $sellerInputRecordModel = Yii::createObject(SellerInputRecordModel::className()); |
24 | 24 | $sellerInputRecordModel->user_mp_id = trim($item["user_mp_id"]); // 用户编号 |
25 | - $sellerInputRecordModel->leave_message = trim($item['leave_message']); // 商家留言 | |
26 | - $sellerInputRecordModel->delivery_address = trim($item['delivery_address']); // 发货地址 | |
27 | - $sellerInputRecordModel->product_image_path = trim($item['product_image_path']); // 商品图片 | |
28 | - $sellerInputRecordModel->product_vedio_path = trim($item['product_vedio_path']); // 商品视频 | |
29 | - $sellerInputRecordModel->buyer_mobile_header = trim($item['buyer_mobile_header']); // 买家手机号开头 | |
30 | - $sellerInputRecordModel->buyer_mobile = trim($item['buyer_mobile']); // 买家手机号 | |
25 | + $sellerInputRecordModel->leave_message = isset($item['leave_message']) ? trim($item['leave_message']) : ""; // 商家留言 | |
26 | + $sellerInputRecordModel->delivery_address = isset($item['delivery_address']) ? trim($item['delivery_address']) : ""; // 发货地址 | |
27 | + $sellerInputRecordModel->product_image_path = isset($item['product_image_path']) ? trim($item['product_image_path']) : ""; // 商品图片 | |
28 | + $sellerInputRecordModel->product_vedio_path = isset($item['product_vedio_path']) ? trim($item['product_vedio_path']) : ""; // 商品视频 | |
29 | + $sellerInputRecordModel->buyer_mobile_header = isset($item['buyer_mobile_header']) ? trim($item['buyer_mobile_header']) : ""; // 买家手机号开头 | |
30 | + $sellerInputRecordModel->buyer_mobile = isset($item['buyer_mobile']) ? trim($item['buyer_mobile']) : ""; // 买家手机号 | |
31 | 31 | $sellerInputRecordModel->uuid = trim($item['uuid']); // 验证编号 |
32 | 32 | $sellerInputRecordModel->extraction_code = trim($item['extraction_code']); // 提取码 |
33 | 33 | $result = $sellerInputRecordModel->save(); |
34 | 34 | |
35 | 35 | if($result) { |
36 | 36 | // 新增用户地址 |
37 | - if (trim($item['delivery_address'])) { | |
37 | + if (trim($item['delivery_address']) && !empty($item['delivery_address'])) { | |
38 | 38 | $userAddressFind = UserAddressRepository::findOne(["user_id" => trim($item["user_mp_id"])]); |
39 | 39 | if ($userAddressFind) { |
40 | 40 | $userAddressFind->address = trim($item['delivery_address']); | ... | ... |