Compare commits
13 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
77da14c696 | 2 years ago |
|
|
3423f1a378 | 2 years ago |
|
|
b9a38b0a68 | 2 years ago |
|
|
43962f17f6 | 2 years ago |
|
|
b9f4d2aafc | 2 years ago |
|
|
b6988600ee | 2 years ago |
|
|
e4a2a0b865 | 2 years ago |
|
|
56edb338d1 | 2 years ago |
|
|
c844d9fed3 | 2 years ago |
|
|
b2985d56c5 | 2 years ago |
|
|
23757d15c6 | 2 years ago |
|
|
ab52efd1d6 | 2 years ago |
|
|
112f25f319 | 2 years ago |
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Mail\Example;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Yo;
|
||||
use Lu;
|
||||
|
||||
class EmailController extends Controller
|
||||
{
|
||||
public function email_test(Request $request)
|
||||
{
|
||||
$to = $request->post('to');
|
||||
$data = ['to' => $to, 'name' => '测试', 'date' => Lu::date()];
|
||||
Mail::to($to)->send(new Example($data));
|
||||
return Yo::echo();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use Yo;
|
||||
use Lu;
|
||||
|
||||
class ExcelController extends Controller
|
||||
{
|
||||
public function excel_test()
|
||||
{
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$worksheet = $spreadsheet->getActiveSheet();
|
||||
$worksheet->setCellValue('A1', 'AAA');
|
||||
$worksheet->setCellValue('B1', Lu::date());
|
||||
$worksheet->setCellValue('C1', 'CCC');
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension('A')->setWidth(20);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(120);
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(50);
|
||||
for ($i = 2; $i <= 11; $i++) {
|
||||
$worksheet->setCellValueExplicit('A' . $i, 'A' . $i, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
|
||||
$worksheet->setCellValueExplicit('B' . $i, 'B' . $i, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
|
||||
$worksheet->setCellValueExplicit('C' . $i, 'C' . $i, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
|
||||
}
|
||||
Yo::echo();
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="导出数据.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
$writer->save('php://output');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\WeChat;
|
||||
use Illuminate\Http\Request;
|
||||
use Yo;
|
||||
|
||||
class WeChatController extends Controller
|
||||
{
|
||||
public function auth($app_id)
|
||||
{
|
||||
$code = request()->get('code');
|
||||
$state = request()->get('state');
|
||||
$we_chat = WeChat::where('app_id', $app_id)->where('type', 1)->first();
|
||||
if (!$we_chat) return Yo::error_echo(100001, ['公众号']);
|
||||
$url = $state . "code=$code";
|
||||
Yo::echo(['url' => $url]);
|
||||
header("Location: $url");
|
||||
exit();
|
||||
}
|
||||
|
||||
public function gzh_login($we_chat, $code)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='
|
||||
. $we_chat->app_id . '&secret='
|
||||
. $we_chat->app_secret . '&code='
|
||||
. $code . '&grant_type=authorization_code';
|
||||
$info = file_get_contents($url);
|
||||
return json_decode($info, true);
|
||||
}
|
||||
|
||||
public function mp_login($we_chat, $code)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/sns/jscode2session?appid='
|
||||
. $we_chat->app_id
|
||||
. '&secret=' . $we_chat->app_secret
|
||||
. '&js_code=' . $code . '&grant_type=authorization_code';
|
||||
$info = file_get_contents($url);
|
||||
$json = json_decode($info);
|
||||
return get_object_vars($json);
|
||||
}
|
||||
|
||||
public function login($code, $app_id)
|
||||
{
|
||||
$we_chat = WeChat::where('app_id', $app_id)->first();
|
||||
$login = false;
|
||||
if (!$we_chat) return false;
|
||||
switch ($we_chat->type) {
|
||||
case 1:
|
||||
$login = $this->gzh_login($we_chat, $code);
|
||||
break;
|
||||
case 2:
|
||||
$login = $this->mp_login($we_chat, $code);
|
||||
break;
|
||||
}
|
||||
return ['login' => !!$login];
|
||||
}
|
||||
|
||||
public function login_test(Request $request)
|
||||
{
|
||||
$code = $request->post('code');
|
||||
$app_id = $request->post('app_id');
|
||||
return Yo::echo([
|
||||
'info' => $this->login($code, $app_id)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,246 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\WeChatPay;
|
||||
use App\Models\WeChatPayLog;
|
||||
use Illuminate\Http\Request;
|
||||
use WeChatPay\Builder;
|
||||
use WeChatPay\Crypto\AesGcm;
|
||||
use WeChatPay\Crypto\Rsa;
|
||||
use WeChatPay\Formatter;
|
||||
use WeChatPay\Util\PemUtil;
|
||||
use Yo;
|
||||
use Lu;
|
||||
|
||||
class WeChatPayController extends Controller
|
||||
{
|
||||
public static $mp_instance = false;
|
||||
public static $mp_config = false;
|
||||
|
||||
public function callback($input, $header, $apiv3Key, $pem)
|
||||
{
|
||||
$inWechatpaySignature = $header['wechatpay-signature'][0];
|
||||
$inWechatpayTimestamp = $header['wechatpay-timestamp'][0];
|
||||
$inWechatpaySerial = $header['wechatpay-serial'][0];
|
||||
$inWechatpayNonce = $header['wechatpay-nonce'][0];
|
||||
$inBody = $input;
|
||||
$platformPublicKeyInstance = Rsa::from($pem, Rsa::KEY_TYPE_PUBLIC);
|
||||
$timeOffsetStatus = 300 >= abs(Formatter::timestamp() - (int)$inWechatpayTimestamp);
|
||||
// $verifiedStatus = Rsa::verify(
|
||||
// Formatter::joinedByLineFeed($inWechatpayTimestamp, $inWechatpayNonce, $inBody),
|
||||
// $inWechatpaySignature,
|
||||
// $platformPublicKeyInstance
|
||||
// );
|
||||
// if ($timeOffsetStatus && $verifiedStatus) {
|
||||
if ($timeOffsetStatus) {
|
||||
$inBodyArray = (array)json_decode($inBody, true);
|
||||
['resource' => [
|
||||
'ciphertext' => $ciphertext,
|
||||
'nonce' => $nonce,
|
||||
'associated_data' => $aad
|
||||
]] = $inBodyArray;
|
||||
$inBodyResource = AesGcm::decrypt($ciphertext, $apiv3Key, $nonce, $aad);
|
||||
return (array)json_decode($inBodyResource, true);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function builder($config)
|
||||
{
|
||||
self::$mp_config = $config;
|
||||
$merchantPrivateKeyFilePath = 'file://' . self::$mp_config['pem_path'];
|
||||
$platformCertificateFilePath = 'file://' . self::$mp_config['cer_path'];
|
||||
$merchantId = self::$mp_config['mchid'];
|
||||
$merchantPrivateKeyInstance = Rsa::from($merchantPrivateKeyFilePath, Rsa::KEY_TYPE_PRIVATE);
|
||||
self::$mp_config['pem_key'] = $merchantPrivateKeyInstance;
|
||||
$merchantCertificateSerial = self::$mp_config['cer_num'];
|
||||
$platformPublicKeyInstance = Rsa::from($platformCertificateFilePath, Rsa::KEY_TYPE_PUBLIC);
|
||||
$platformCertificateSerial = self::$mp_config['v3'];
|
||||
self::$mp_instance = Builder::factory([
|
||||
'mchid' => $merchantId,
|
||||
'serial' => $merchantCertificateSerial,
|
||||
'privateKey' => $merchantPrivateKeyInstance,
|
||||
'certs' => [
|
||||
$platformCertificateSerial => $platformPublicKeyInstance,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function refund($config)
|
||||
{
|
||||
$res = false;
|
||||
try {
|
||||
$resp = self::$mp_instance
|
||||
->v3->refund->domestic->refunds
|
||||
->post([
|
||||
'json' => [
|
||||
'transaction_id' => $config['transaction_id'],
|
||||
'out_refund_no' => $config['out_refund_no'],
|
||||
'amount' => [
|
||||
'refund' => $config['total'],
|
||||
'total' => $config['total'],
|
||||
'currency' => 'CNY',
|
||||
],
|
||||
],
|
||||
]);
|
||||
$res = json_decode($resp->getBody(), true);
|
||||
} catch (\Exception $e) {
|
||||
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
|
||||
$r = $e->getResponse();
|
||||
$res = json_decode($r->getBody(), true);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function create($config)
|
||||
{
|
||||
$res = false;
|
||||
try {
|
||||
$post_data = [
|
||||
'appid' => self::$mp_config['appid'],
|
||||
'mchid' => self::$mp_config['mchid'],
|
||||
'description' => $config['description'],
|
||||
'out_trade_no' => $config['out_trade_no'],
|
||||
'notify_url' => $config['notify_url'],
|
||||
'amount' => [
|
||||
'total' => $config['total'],
|
||||
],
|
||||
'payer' => [
|
||||
'openid' => $config['openid']
|
||||
]
|
||||
];
|
||||
$resp = self::$mp_instance
|
||||
->v3->pay->transactions->jsapi
|
||||
->post([
|
||||
'json' => $post_data,
|
||||
]);
|
||||
$res = json_decode($resp->getBody(), true);
|
||||
} catch (\Exception $e) {
|
||||
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
|
||||
$r = $e->getResponse();
|
||||
$res = json_decode($r->getBody(), true);
|
||||
}
|
||||
}
|
||||
$params = [
|
||||
'appId' => self::$mp_config['appid'],
|
||||
'timeStamp' => (string)time(),
|
||||
'nonceStr' => self::nonce(),
|
||||
'package' => 'prepay_id=' . $res['prepay_id'],
|
||||
];
|
||||
$params += ['paySign' => Rsa::sign(
|
||||
Formatter::joinedByLineFeed(...array_values($params)),
|
||||
self::$mp_config['pem_key']
|
||||
), 'signType' => 'RSA'];
|
||||
$wc_chat_pay_log = new WeChatPayLog();
|
||||
$wc_chat_pay_log->out_trade_no = $config['out_trade_no'];
|
||||
$wc_chat_pay_log->post_data = json_encode($post_data, JSON_UNESCAPED_UNICODE);
|
||||
$wc_chat_pay_log->params = json_encode($params, JSON_UNESCAPED_UNICODE);
|
||||
$wc_chat_pay_log->save();
|
||||
return [
|
||||
'appid' => $params['appId'],
|
||||
'timestamp' => $params['timeStamp'],
|
||||
'nonce_str' => $params['nonceStr'],
|
||||
'package' => $params['package'],
|
||||
'pay_sign' => $params['paySign'],
|
||||
'sign_type' => $params['signType'],
|
||||
];
|
||||
}
|
||||
|
||||
public function check($out_trade_no)
|
||||
{
|
||||
$res = false;
|
||||
try {
|
||||
$resp = self::$mp_instance
|
||||
->v3->pay->transactions->outTradeNo->_out_trade_no_
|
||||
->get([
|
||||
'query' => ['mchid' => self::$mp_config['mchid']],
|
||||
'out_trade_no' => (string)$out_trade_no,
|
||||
]);
|
||||
$res = json_decode($resp->getBody(), true);
|
||||
} catch (\Exception $e) {
|
||||
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
|
||||
$r = $e->getResponse();
|
||||
$res = json_decode($r->getBody(), true);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function nonce($l = 16)
|
||||
{
|
||||
$charts = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz0123456789";
|
||||
$max = strlen($charts) - 1;
|
||||
$noncestr = "";
|
||||
for ($i = 0; $i < $l; $i++) {
|
||||
$noncestr .= $charts[rand(0, $max)];
|
||||
}
|
||||
return $noncestr;
|
||||
}
|
||||
|
||||
public function pay($open_id, $app_id, $out_trade_no, $price, $description)
|
||||
{
|
||||
$we_chat_pay = WeChatPay::where('app_id', $app_id)->first();
|
||||
if (!$we_chat_pay) return false;
|
||||
self::builder([
|
||||
'appid' => $we_chat_pay->app_id,
|
||||
'pem_path' => base_path($we_chat_pay->key),
|
||||
'cer_path' => base_path($we_chat_pay->crt),
|
||||
'cer_num' => $we_chat_pay->number,
|
||||
'mchid' => $we_chat_pay->pay_id,
|
||||
'v3' => $we_chat_pay->v3,
|
||||
]);
|
||||
return self::create([
|
||||
'description' => $description,
|
||||
'out_trade_no' => $out_trade_no,
|
||||
'notify_url' => $we_chat_pay->notify_url,
|
||||
'total' => $price * 100,
|
||||
'openid' => $open_id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function pay_test(Request $request)
|
||||
{
|
||||
$app_id = $request->post('app_id');
|
||||
$open_id = $request->post('open_id');
|
||||
$info = self::pay(
|
||||
$open_id,
|
||||
$app_id,
|
||||
time() . rand(1000, 9999),
|
||||
0.01,
|
||||
'测试支付'
|
||||
);
|
||||
return Yo::echo([
|
||||
'info' => $info
|
||||
]);
|
||||
}
|
||||
|
||||
public function callback_test($app_id)
|
||||
{
|
||||
$input = file_get_contents('php://input');
|
||||
$headers = request()->header();
|
||||
$we_chat_pay = WeChatPay::where('app_id', $app_id)->first();
|
||||
if (!$we_chat_pay) return false;
|
||||
$res = $this->callback($input, $headers, $we_chat_pay->v3, 'file://' . base_path($we_chat_pay->crt));
|
||||
if (!!$res) {
|
||||
if ($res['trade_state'] == 'SUCCESS') {
|
||||
$we_chat_pay_log = WeChatPayLog::where('out_trade_no', $res['out_trade_no'])->first();
|
||||
if (!!$we_chat_pay_log) {
|
||||
$we_chat_pay_log->callback = json_encode([
|
||||
'type' => 'callback',
|
||||
'input' => $input,
|
||||
'headers' => $headers,
|
||||
'res' => $res,
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
$we_chat_pay_log->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Lu::exit([
|
||||
'code' => 'SUCCESS',
|
||||
'message' => '成功',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Example extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$email_log = new \App\Models\EmailLog();
|
||||
$email_log->to = $this->data['to'];
|
||||
$email_log->view = 'emails.example';
|
||||
unset($this->data['to']);
|
||||
$email_log->data = json_encode($this->data, JSON_UNESCAPED_UNICODE);
|
||||
$email_log->save();
|
||||
return $this->view('emails.example')->subject('Example Email')->with('data', $this->data);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EmailLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WeChat extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WeChatPay extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WeChatPayLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('we_chats', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 50)->comment('名称');
|
||||
$table->tinyInteger('type')->comment('1-公众号 2-小程序');
|
||||
$table->string('app_id', 80)->comment('小程序ID')->index();
|
||||
$table->string('app_secret', 100)->comment('小程序密钥')->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('we_chats');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('we_chat_pays', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('app_id', 80)->comment('APPID')->index();
|
||||
$table->string('pay_id', 20)->comment('商户号');
|
||||
$table->string('number', 100)->comment('证书编号');
|
||||
$table->string('v3', 100)->comment('API KEY V3');
|
||||
$table->string('key', 200)->comment('证书 Key');
|
||||
$table->string('crt', 200)->comment('证书 Crt');
|
||||
$table->string('notify_url', 200)->comment('回调地址');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('we_chat_pays');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('we_chat_pay_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('out_trade_no', 100)->index();
|
||||
$table->text('post_data');
|
||||
$table->text('params');
|
||||
$table->longText('callback')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('we_chat_pay_logs');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('email_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('to', 200)->index();
|
||||
$table->string('view', 50);
|
||||
$table->string('data', 1000);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('email_logs');
|
||||
}
|
||||
};
|
||||
@ -1,13 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.1.2",
|
||||
"laravel-vite-plugin": "^0.7.5",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
unpackage
|
||||
.hbuilderx
|
||||
@ -0,0 +1,61 @@
|
||||
<script>
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log(`\n %c 鹿和 %c https://sa0.online/ \n\n`, 'color: #ffffff; background: #fd6b60; padding:5px 0;',
|
||||
'color: #fd6b60;background: #ffffff; padding:5px 0;')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/*每个页面公共css */
|
||||
@import '@/uni_modules/uni-scss/index.scss';
|
||||
/* #ifndef APP-NVUE */
|
||||
@import '@/static/customicons.css';
|
||||
|
||||
// 设置整个项目的背景色
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
.bottom_blank_wrapper {
|
||||
height: calc(20rpx + var(--safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.top_blank_wrapper::after {
|
||||
content: ".";
|
||||
}
|
||||
|
||||
.top_blank_wrapper {
|
||||
height: 0;
|
||||
width: 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.navbar_blank_wrapper {
|
||||
height: calc(100rpx + var(--safe-area-inset-top));
|
||||
}
|
||||
|
||||
.input_line_wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.input_line_tag_wrapper {
|
||||
width: 200rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
text-align: center;
|
||||
background: #f9f9f9;
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.input_line_input_wrapper {
|
||||
width: 500rpx;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,60 @@
|
||||
import {
|
||||
$post
|
||||
} from '@/lu/axios.js'
|
||||
import $config from '@/config.js'
|
||||
const app_path = 'App'
|
||||
let url = ''
|
||||
let gzh = {
|
||||
id: '',
|
||||
jump: '',
|
||||
auth: ''
|
||||
}
|
||||
const urlPick = () => {
|
||||
if ($config.config.length > 0) {
|
||||
url = $config.config[0].url
|
||||
gzh = $config.config[0].gzh
|
||||
for (let i in $config.config) {
|
||||
if (!!$config.config[i].active) {
|
||||
url = $config.config[i].url
|
||||
gzh = $config.config[i].gzh
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
urlPick()
|
||||
|
||||
export const GzhConfig = gzh
|
||||
export const WeChatPayPayTestAction = async (data) => await $post({
|
||||
url: `${url}/api/Test/WeChatPay/pay_test`,
|
||||
data
|
||||
})
|
||||
export const WeChatLoginTestAction = async (data) => await $post({
|
||||
url: `${url}/api/Test/WeChat/login_test`,
|
||||
data
|
||||
})
|
||||
export const yo = async (data) => await $post({
|
||||
url: `${url}/api/yo`,
|
||||
data
|
||||
})
|
||||
|
||||
export const $image = (path) => {
|
||||
const path_ret = ['http://', 'https://', ';base64,']
|
||||
for (let i = 0; i < path_ret.length; i++) {
|
||||
if (path.indexOf(path_ret[i]) !== -1) {
|
||||
return path
|
||||
}
|
||||
}
|
||||
return `${$config.url}${path}`
|
||||
}
|
||||
|
||||
export const $response = (response, then, error = () => {}) => {
|
||||
if (response) {
|
||||
if (response.code != 200) {
|
||||
uni.$lu.toast(response.message);
|
||||
error()
|
||||
return
|
||||
}
|
||||
then()
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
const config = [{
|
||||
active: true,
|
||||
url: 'http://lucode3.sa0.online',
|
||||
gzh: {
|
||||
id: 'wx526430047d34c85c',
|
||||
jump: 'https://lucode3.sa0.online/h5/#/pages/gzh/login/login?',
|
||||
auth: 'https://lucode3.sa0.online/open/Gzh/auth/wx526430047d34c85c'
|
||||
},
|
||||
}, {
|
||||
active: false,
|
||||
url: 'http://127.0.0.1:8000',
|
||||
gzh: {
|
||||
id: 'wx526430047d34c85c',
|
||||
jump: 'http://127.0.0.1:5173/h5/#/pages/gzh/login/login?',
|
||||
auth: 'https://lucode3.sa0.online/open/Gzh/auth/wx526430047d34c85c'
|
||||
},
|
||||
}]
|
||||
uni.$config = JSON.parse(JSON.stringify(config))
|
||||
const config_str_key = "CONFIG_STR"
|
||||
let config_str = uni.getStorageSync(config_str_key)
|
||||
if (!config_str) {
|
||||
config_str = JSON.stringify(config)
|
||||
uni.setStorageSync(config_str_key, config_str)
|
||||
}
|
||||
const config_data = JSON.parse(config_str)
|
||||
export default {
|
||||
title: '鹿和开发套件',
|
||||
app_id: 'wx0d92d2990ec16a55',
|
||||
config: config_data,
|
||||
token: '0995452A-0D59-44B6-B6CA-88D8B1E257A0'
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title></title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,24 @@
|
||||
import {
|
||||
getToken
|
||||
} from './token.js'
|
||||
|
||||
export const $post = async ({
|
||||
url,
|
||||
data = {}
|
||||
}) => {
|
||||
const token = getToken() ? getToken() : '';
|
||||
const res = await uni.request({
|
||||
url,
|
||||
method: 'POST',
|
||||
data,
|
||||
header: {
|
||||
Authorization: 'Bearer ' + token
|
||||
}
|
||||
});
|
||||
if (!!res && res.data != '') {
|
||||
return res.data
|
||||
} else {
|
||||
uni.$lu.toast("请求发生错误")
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
const format = (value = Date.now(), format = "Y-M-D h:m:s") => {
|
||||
const formatNumber = n => `0${n}`.slice(-2);
|
||||
const date = new Date(value);
|
||||
const formatList = ["Y", "M", "D", "h", "m", "s"];
|
||||
const resultList = [];
|
||||
resultList.push(date.getFullYear().toString());
|
||||
resultList.push(formatNumber(date.getMonth() + 1));
|
||||
resultList.push(formatNumber(date.getDate()));
|
||||
resultList.push(formatNumber(date.getHours()));
|
||||
resultList.push(formatNumber(date.getMinutes()));
|
||||
resultList.push(formatNumber(date.getSeconds()));
|
||||
for (let i = 0; i < resultList.length; i++) {
|
||||
format = format.replace(formatList[i], resultList[i]);
|
||||
}
|
||||
return format;
|
||||
}
|
||||
export default format
|
||||
@ -0,0 +1,8 @@
|
||||
import config from '@/config.js'
|
||||
import toast from './toast.js';
|
||||
import format from './format.js';
|
||||
export default {
|
||||
toast,
|
||||
format,
|
||||
config,
|
||||
};
|
||||
@ -0,0 +1,9 @@
|
||||
const toast = (title, duration = 1500) => {
|
||||
uni.showToast({
|
||||
title: title,
|
||||
icon: 'none',
|
||||
duration: duration
|
||||
})
|
||||
}
|
||||
|
||||
export default toast
|
||||
@ -0,0 +1,11 @@
|
||||
import $config from '@/config.js'
|
||||
const TokenKey = $config.token;
|
||||
export function getToken() {
|
||||
return uni.getStorageSync(TokenKey);
|
||||
}
|
||||
export function setToken(token) {
|
||||
uni.setStorageSync(TokenKey, token);
|
||||
}
|
||||
export function delToken() {
|
||||
uni.removeStorageSync(TokenKey);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
import {
|
||||
createSSRApp
|
||||
} from 'vue'
|
||||
import * as Pinia from 'pinia';
|
||||
import App from './App.vue'
|
||||
import $lu from './lu'
|
||||
|
||||
uni.$lu = $lu
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(Pinia.createPinia())
|
||||
return {
|
||||
app,
|
||||
Pinia
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
{
|
||||
"name" : "鹿和开发模板",
|
||||
"appid" : "__UNI__54F7FDE",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
/* 5+App特有相关 */
|
||||
"usingComponents" : true,
|
||||
"nvueCompiler" : "uni-app",
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
"modules" : {},
|
||||
/* 模块配置 */
|
||||
"distribute" : {
|
||||
/* 应用发布信息 */
|
||||
"android" : {
|
||||
/* android打包配置 */
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
"ios" : {},
|
||||
/* ios打包配置 */
|
||||
"sdkConfigs" : {}
|
||||
}
|
||||
},
|
||||
/* SDK配置 */
|
||||
"quickapp" : {},
|
||||
/* 快应用特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wx0d92d2990ec16a55",
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"vueVersion" : "3",
|
||||
"h5" : {
|
||||
"router" : {
|
||||
"base" : "/h5/"
|
||||
},
|
||||
"title" : "鹿和开发模板"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
{
|
||||
"pages": [{
|
||||
"path": "pages/main/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "鹿和开发模板",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/main/my/my",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的"
|
||||
}
|
||||
}],
|
||||
"subPackages": [{
|
||||
"root": "pages/dev",
|
||||
"pages": [{
|
||||
"path": "example/example",
|
||||
"style": {
|
||||
"navigationBarTitleText": "示例",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
"path": "proxy/proxy",
|
||||
"style": {
|
||||
"navigationBarTitleText": "代理设置",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}]
|
||||
}, {
|
||||
"root": "pages/gzh",
|
||||
"pages": [{
|
||||
"path": "login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "公众号登录跳转",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
|
||||
}]
|
||||
}],
|
||||
"tabBar": {
|
||||
"color": "#7A7E83",
|
||||
"selectedColor": "#333333",
|
||||
"borderStyle": "white",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [{
|
||||
"pagePath": "pages/main/index/index",
|
||||
"iconPath": "static/tabbar/tof.png",
|
||||
"selectedIconPath": "static/tabbar/ton.png",
|
||||
"text": "首页"
|
||||
}, {
|
||||
"pagePath": "pages/main/my/my",
|
||||
"iconPath": "static/tabbar/tof.png",
|
||||
"selectedIconPath": "static/tabbar/ton.png",
|
||||
"text": "我的"
|
||||
}]
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "鹿和开发套件",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8",
|
||||
"app-plus": {
|
||||
"background": "#efeff4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 401 B |
|
After Width: | Height: | Size: 470 B |
|
After Width: | Height: | Size: 511 B |
|
After Width: | Height: | Size: 476 B |
|
After Width: | Height: | Size: 472 B |
|
After Width: | Height: | Size: 545 B |
|
After Width: | Height: | Size: 365 B |
|
After Width: | Height: | Size: 587 B |
|
After Width: | Height: | Size: 565 B |
@ -0,0 +1,20 @@
|
||||
@font-face {
|
||||
font-family: "customicons"; /* Project id 2878519 */
|
||||
src:url('/static/customicons.ttf') format('truetype');
|
||||
}
|
||||
|
||||
.customicons {
|
||||
font-family: "customicons" !important;
|
||||
}
|
||||
|
||||
.youxi:before {
|
||||
content: "\e60e";
|
||||
}
|
||||
|
||||
.wenjian:before {
|
||||
content: "\e60f";
|
||||
}
|
||||
|
||||
.zhuanfa:before {
|
||||
content: "\e610";
|
||||
}
|
||||
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
@ -0,0 +1,19 @@
|
||||
import {
|
||||
defineStore
|
||||
} from 'pinia';
|
||||
|
||||
export const useStore = defineStore('counter', {
|
||||
state: () => ({
|
||||
count: 1,
|
||||
loading: 0,
|
||||
}),
|
||||
actions: {
|
||||
loadingStart() {
|
||||
this.loading++
|
||||
},
|
||||
loadingDone() {
|
||||
this.loading--
|
||||
if (this.loading < 0) this.loading = 0
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -0,0 +1 @@
|
||||
@import '@/uni_modules/uni-scss/variables.scss';
|
||||
@ -0,0 +1,85 @@
|
||||
{
|
||||
"id": "uni-badge",
|
||||
"displayName": "uni-badge 数字角标",
|
||||
"version": "1.2.2",
|
||||
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
|
||||
"keywords": [
|
||||
"",
|
||||
"badge",
|
||||
"uni-ui",
|
||||
"uniui",
|
||||
"数字角标",
|
||||
"徽章"
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-scss"],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "y",
|
||||
"联盟": "y"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
{
|
||||
"id": "uni-breadcrumb",
|
||||
"displayName": "uni-breadcrumb 面包屑",
|
||||
"version": "0.1.2",
|
||||
"description": "Breadcrumb 面包屑",
|
||||
"keywords": [
|
||||
"uni-breadcrumb",
|
||||
"breadcrumb",
|
||||
"uni-ui",
|
||||
"面包屑导航",
|
||||
"面包屑"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": ""
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
},
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "n"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "u",
|
||||
"百度": "u",
|
||||
"字节跳动": "u",
|
||||
"QQ": "u",
|
||||
"京东": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"uni-calender.ok": "ok",
|
||||
"uni-calender.cancel": "cancel",
|
||||
"uni-calender.today": "today",
|
||||
"uni-calender.MON": "MON",
|
||||
"uni-calender.TUE": "TUE",
|
||||
"uni-calender.WED": "WED",
|
||||
"uni-calender.THU": "THU",
|
||||
"uni-calender.FRI": "FRI",
|
||||
"uni-calender.SAT": "SAT",
|
||||
"uni-calender.SUN": "SUN"
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import en from './en.json'
|
||||
import zhHans from './zh-Hans.json'
|
||||
import zhHant from './zh-Hant.json'
|
||||
export default {
|
||||
en,
|
||||
'zh-Hans': zhHans,
|
||||
'zh-Hant': zhHant
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"uni-calender.ok": "确定",
|
||||
"uni-calender.cancel": "取消",
|
||||
"uni-calender.today": "今日",
|
||||
"uni-calender.SUN": "日",
|
||||
"uni-calender.MON": "一",
|
||||
"uni-calender.TUE": "二",
|
||||
"uni-calender.WED": "三",
|
||||
"uni-calender.THU": "四",
|
||||
"uni-calender.FRI": "五",
|
||||
"uni-calender.SAT": "六"
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"uni-calender.ok": "確定",
|
||||
"uni-calender.cancel": "取消",
|
||||
"uni-calender.today": "今日",
|
||||
"uni-calender.SUN": "日",
|
||||
"uni-calender.MON": "一",
|
||||
"uni-calender.TUE": "二",
|
||||
"uni-calender.WED": "三",
|
||||
"uni-calender.THU": "四",
|
||||
"uni-calender.FRI": "五",
|
||||
"uni-calender.SAT": "六"
|
||||
}
|
||||
@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<view class="uni-calendar-item__weeks-box" :class="{
|
||||
'uni-calendar-item--disable':weeks.disable,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) ,
|
||||
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||
}"
|
||||
@click="choiceDate(weeks)">
|
||||
<view class="uni-calendar-item__weeks-box-item">
|
||||
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
|
||||
<text class="uni-calendar-item__weeks-box-text" :class="{
|
||||
'uni-calendar-item--isDay-text': weeks.isDay,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||
'uni-calendar-item--disable':weeks.disable,
|
||||
}">{{weeks.date}}</text>
|
||||
<text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||
}">{{todayText}}</text>
|
||||
<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||
'uni-calendar-item--disable':weeks.disable,
|
||||
}">{{weeks.isDay ? todayText : (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text>
|
||||
<text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||
'uni-calendar-item--extra':weeks.extraInfo.info,
|
||||
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||
'uni-calendar-item--disable':weeks.disable,
|
||||
}">{{weeks.extraInfo.info}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { initVueI18n } from '@dcloudio/uni-i18n'
|
||||
import i18nMessages from './i18n/index.js'
|
||||
const { t } = initVueI18n(i18nMessages)
|
||||
|
||||
export default {
|
||||
emits:['change'],
|
||||
props: {
|
||||
weeks: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
calendar: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
selected: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
lunar: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
todayText() {
|
||||
return t("uni-calender.today")
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
choiceDate(weeks) {
|
||||
this.$emit('change', weeks)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$uni-font-size-base:14px;
|
||||
$uni-text-color:#333;
|
||||
$uni-font-size-sm:12px;
|
||||
$uni-color-error: #e43d33;
|
||||
$uni-opacity-disabled: 0.3;
|
||||
$uni-text-color-disable:#c0c0c0;
|
||||
$uni-primary: #2979ff !default;
|
||||
.uni-calendar-item__weeks-box {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-box-text {
|
||||
font-size: $uni-font-size-base;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-lunar-text {
|
||||
font-size: $uni-font-size-sm;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-box-item {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-box-circle {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 8px;
|
||||
background-color: $uni-color-error;
|
||||
|
||||
}
|
||||
|
||||
.uni-calendar-item--disable {
|
||||
background-color: rgba(249, 249, 249, $uni-opacity-disabled);
|
||||
color: $uni-text-color-disable;
|
||||
}
|
||||
|
||||
.uni-calendar-item--isDay-text {
|
||||
color: $uni-primary;
|
||||
}
|
||||
|
||||
.uni-calendar-item--isDay {
|
||||
background-color: $uni-primary;
|
||||
opacity: 0.8;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.uni-calendar-item--extra {
|
||||
color: $uni-color-error;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.uni-calendar-item--checked {
|
||||
background-color: $uni-primary;
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.uni-calendar-item--multiple {
|
||||
background-color: $uni-primary;
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.uni-calendar-item--before-checked {
|
||||
background-color: #ff5a5f;
|
||||
color: #fff;
|
||||
}
|
||||
.uni-calendar-item--after-checked {
|
||||
background-color: #ff5a5f;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,85 @@
|
||||
{
|
||||
"id": "uni-calendar",
|
||||
"displayName": "uni-calendar 日历",
|
||||
"version": "1.4.10",
|
||||
"description": "日历组件",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
"uniui",
|
||||
"日历",
|
||||
"",
|
||||
"打卡",
|
||||
"日历选择"
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
{
|
||||
"id": "uni-card",
|
||||
"displayName": "uni-card 卡片",
|
||||
"version": "1.3.1",
|
||||
"description": "Card 组件,提供常见的卡片样式。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
"uniui",
|
||||
"card",
|
||||
"",
|
||||
"卡片"
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
"uni-icons",
|
||||
"uni-scss"
|
||||
],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
{
|
||||
"id": "uni-collapse",
|
||||
"displayName": "uni-collapse 折叠面板",
|
||||
"version": "1.4.3",
|
||||
"description": "Collapse 组件,可以折叠 / 展开的内容区域。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
"折叠",
|
||||
"折叠面板",
|
||||
"手风琴"
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
"uni-scss",
|
||||
"uni-icons"
|
||||
],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||